2016-06-04 06:07:50 +00:00
|
|
|
from __future__ import unicode_literals
|
2017-03-03 07:55:59 +00:00
|
|
|
|
|
|
|
class WormholeError(Exception):
|
|
|
|
"""Parent class for all wormhole-related errors"""
|
|
|
|
|
|
|
|
class ServerError(WormholeError):
|
|
|
|
"""The relay server complained about something we did."""
|
|
|
|
|
|
|
|
class Timeout(WormholeError):
|
2015-09-22 06:21:26 +00:00
|
|
|
pass
|
|
|
|
|
2017-03-03 07:55:59 +00:00
|
|
|
class WelcomeError(WormholeError):
|
2016-05-26 22:36:44 +00:00
|
|
|
"""
|
|
|
|
The relay server told us to signal an error, probably because our version
|
|
|
|
is too old to possibly work. The server said:"""
|
|
|
|
pass
|
2016-05-23 07:14:39 +00:00
|
|
|
|
2017-03-03 07:55:59 +00:00
|
|
|
class LonelyError(WormholeError):
|
|
|
|
"""wormhole.close() was called before the peer connection could be
|
|
|
|
established"""
|
|
|
|
|
|
|
|
class WrongPasswordError(WormholeError):
|
2015-09-22 06:21:26 +00:00
|
|
|
"""
|
|
|
|
Key confirmation failed. Either you or your correspondent typed the code
|
|
|
|
wrong, or a would-be man-in-the-middle attacker guessed incorrectly. You
|
|
|
|
could try again, giving both your correspondent and the attacker another
|
|
|
|
chance.
|
|
|
|
"""
|
|
|
|
# or the data blob was corrupted, and that's why decrypt failed
|
2016-05-26 22:36:44 +00:00
|
|
|
pass
|
2015-09-22 06:21:26 +00:00
|
|
|
|
2017-03-03 07:55:59 +00:00
|
|
|
class KeyFormatError(WormholeError):
|
2016-06-02 21:07:27 +00:00
|
|
|
"""
|
|
|
|
The key you entered contains spaces. Magic-wormhole expects keys to be
|
2016-06-02 21:27:14 +00:00
|
|
|
separated by dashes. Please reenter the key you were given separating the
|
|
|
|
words with dashes.
|
2016-06-02 21:07:27 +00:00
|
|
|
"""
|
|
|
|
|
2017-03-03 07:55:59 +00:00
|
|
|
class ReflectionAttack(WormholeError):
|
2015-09-22 06:21:26 +00:00
|
|
|
"""An attacker (or bug) reflected our outgoing message back to us."""
|
|
|
|
|
2017-03-03 07:55:59 +00:00
|
|
|
class InternalError(WormholeError):
|
2015-09-22 06:21:26 +00:00
|
|
|
"""The programmer did something wrong."""
|
2016-02-16 05:40:57 +00:00
|
|
|
|
2016-06-22 08:04:05 +00:00
|
|
|
class WormholeClosedError(InternalError):
|
2016-05-24 05:53:00 +00:00
|
|
|
"""API calls may not be made after close() is called."""
|
|
|
|
|
2017-03-03 07:55:59 +00:00
|
|
|
class TransferError(WormholeError):
|
2016-02-16 05:40:57 +00:00
|
|
|
"""Something bad happened and the transfer failed."""
|
2017-01-15 22:35:46 +00:00
|
|
|
|
2017-03-03 07:55:59 +00:00
|
|
|
class NoTorError(WormholeError):
|
2017-01-15 22:35:46 +00:00
|
|
|
"""--tor was requested, but 'txtorcon' is not installed."""
|
2017-03-04 09:55:42 +00:00
|
|
|
|
|
|
|
class NoKeyError(WormholeError):
|
|
|
|
"""w.derive_key() was called before got_verifier() fired"""
|
2017-03-07 11:09:06 +00:00
|
|
|
|
2017-03-08 07:45:11 +00:00
|
|
|
class OnlyOneCodeError(WormholeError):
|
|
|
|
"""Only one w.generate_code/w.set_code/w.type_code may be called"""
|
|
|
|
|
2017-03-07 11:09:06 +00:00
|
|
|
class WormholeClosed(Exception):
|
|
|
|
"""Deferred-returning API calls errback with WormholeClosed if the
|
|
|
|
wormhole was already closed, or if it closes before a real result can be
|
|
|
|
obtained."""
|
|
|
|
|