cli: print useful error when --tor is requested but unavailable

This commit is contained in:
Brian Warner 2017-01-15 17:35:46 -05:00
parent 33370bb1b3
commit aa772858f5
2 changed files with 5 additions and 2 deletions

View File

@ -9,7 +9,7 @@ from . import public_relay
from .. import __version__
from ..timing import DebugTiming
from ..errors import (WrongPasswordError, WelcomeError, KeyFormatError,
TransferError)
TransferError, NoTorError)
from twisted.internet.defer import inlineCallbacks, maybeDeferred
from twisted.python.failure import Failure
from twisted.internet.task import react
@ -104,7 +104,7 @@ def _dispatch_command(reactor, cfg, command):
try:
yield maybeDeferred(command)
except (WrongPasswordError, KeyFormatError) as e:
except (WrongPasswordError, KeyFormatError, NoTorError) as e:
msg = fill("ERROR: " + dedent(e.__doc__))
print(msg, file=stderr)
raise SystemExit(1)

View File

@ -55,3 +55,6 @@ class WormholeClosedError(InternalError):
class TransferError(Exception):
"""Something bad happened and the transfer failed."""
class NoTorError(Exception):
"""--tor was requested, but 'txtorcon' is not installed."""