CLI: exit with rc=1 upon errors
This commit is contained in:
parent
64307d3531
commit
58c7639635
|
@ -100,17 +100,16 @@ def _dispatch_command(reactor, cfg, command):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield maybeDeferred(command)
|
yield maybeDeferred(command)
|
||||||
except WrongPasswordError as e:
|
except (WrongPasswordError, KeyFormatError) as e:
|
||||||
msg = fill("ERROR: " + dedent(e.__doc__))
|
msg = fill("ERROR: " + dedent(e.__doc__))
|
||||||
print(msg, file=stderr)
|
print(msg, file=stderr)
|
||||||
|
raise SystemExit(1)
|
||||||
except WelcomeError as e:
|
except WelcomeError as e:
|
||||||
msg = fill("ERROR: " + dedent(e.__doc__))
|
msg = fill("ERROR: " + dedent(e.__doc__))
|
||||||
print(msg, file=stderr)
|
print(msg, file=stderr)
|
||||||
print(file=stderr)
|
print(file=stderr)
|
||||||
print(str(e), file=stderr)
|
print(str(e), file=stderr)
|
||||||
except KeyFormatError as e:
|
raise SystemExit(1)
|
||||||
msg = fill("ERROR: " + dedent(e.__doc__))
|
|
||||||
print(msg, file=stderr)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# this prints a proper traceback, whereas
|
# this prints a proper traceback, whereas
|
||||||
# traceback.print_exc() just prints a TB to the "yield"
|
# traceback.print_exc() just prints a TB to the "yield"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user