cli: print useful error when --tor is requested but unavailable
This commit is contained in:
parent
33370bb1b3
commit
aa772858f5
|
@ -9,7 +9,7 @@ from . import public_relay
|
||||||
from .. import __version__
|
from .. import __version__
|
||||||
from ..timing import DebugTiming
|
from ..timing import DebugTiming
|
||||||
from ..errors import (WrongPasswordError, WelcomeError, KeyFormatError,
|
from ..errors import (WrongPasswordError, WelcomeError, KeyFormatError,
|
||||||
TransferError)
|
TransferError, NoTorError)
|
||||||
from twisted.internet.defer import inlineCallbacks, maybeDeferred
|
from twisted.internet.defer import inlineCallbacks, maybeDeferred
|
||||||
from twisted.python.failure import Failure
|
from twisted.python.failure import Failure
|
||||||
from twisted.internet.task import react
|
from twisted.internet.task import react
|
||||||
|
@ -104,7 +104,7 @@ def _dispatch_command(reactor, cfg, command):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield maybeDeferred(command)
|
yield maybeDeferred(command)
|
||||||
except (WrongPasswordError, KeyFormatError) as e:
|
except (WrongPasswordError, KeyFormatError, NoTorError) 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)
|
raise SystemExit(1)
|
||||||
|
|
|
@ -55,3 +55,6 @@ class WormholeClosedError(InternalError):
|
||||||
|
|
||||||
class TransferError(Exception):
|
class TransferError(Exception):
|
||||||
"""Something bad happened and the transfer failed."""
|
"""Something bad happened and the transfer failed."""
|
||||||
|
|
||||||
|
class NoTorError(Exception):
|
||||||
|
"""--tor was requested, but 'txtorcon' is not installed."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user