Skip to content
Snippets Groups Projects
Commit d996a938 authored by Matt Traudt's avatar Matt Traudt
Browse files

Act safely when circuit_str can't get the circuit

parent ea5dcce2
Branches
Tags
No related merge requests found
......@@ -256,7 +256,12 @@ def circuit_str(controller, circ_id):
assert is_controller_okay(controller)
assert isinstance(circ_id, str)
int(circ_id)
circ = controller.get_circuit(circ_id)
try:
circ = controller.get_circuit(circ_id)
except ValueError as e:
log.warning('Circuit %s no longer seems to exist so can\'t return '
'a valid circuit string for it: %s', circ_id, e)
return None
return '[' +\
' -> '.join(['{} ({})'.format(n, fp[0:8]) for fp, n in circ.path]) +\
']'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment