CLI: don't emit traceback for TransferErrors

But do print the message contained therein

refs #74
This commit is contained in:
Brian Warner 2016-12-08 16:49:44 -08:00
parent 58c7639635
commit ab972785aa

View File

@ -8,7 +8,8 @@ from sys import stdout, stderr
from . import public_relay
from .. import __version__
from ..timing import DebugTiming
from ..errors import WrongPasswordError, WelcomeError, KeyFormatError
from ..errors import (WrongPasswordError, WelcomeError, KeyFormatError,
TransferError)
from twisted.internet.defer import inlineCallbacks, maybeDeferred
from twisted.python.failure import Failure
from twisted.internet.task import react
@ -110,6 +111,9 @@ def _dispatch_command(reactor, cfg, command):
print(file=stderr)
print(str(e), file=stderr)
raise SystemExit(1)
except TransferError as e:
print("TransferError: %s" % str(e), file=stderr)
raise SystemExit(1)
except Exception as e:
# this prints a proper traceback, whereas
# traceback.print_exc() just prints a TB to the "yield"