magic-wormhole/src/wormhole/errors.py

65 lines
2.0 KiB
Python
Raw Normal View History

from __future__ import unicode_literals
class WormholeError(Exception):
"""Parent class for all wormhole-related errors"""
class ServerError(WormholeError):
"""The relay server complained about something we did."""
class Timeout(WormholeError):
pass
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
class LonelyError(WormholeError):
"""wormhole.close() was called before the peer connection could be
established"""
class WrongPasswordError(WormholeError):
"""
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
class KeyFormatError(WormholeError):
2016-06-02 21:07:27 +00:00
"""
The key you entered contains spaces. Magic-wormhole expects keys to be
separated by dashes. Please reenter the key you were given separating the
words with dashes.
2016-06-02 21:07:27 +00:00
"""
class ReflectionAttack(WormholeError):
"""An attacker (or bug) reflected our outgoing message back to us."""
class InternalError(WormholeError):
"""The programmer did something wrong."""
class WormholeClosedError(InternalError):
"""API calls may not be made after close() is called."""
class TransferError(WormholeError):
"""Something bad happened and the transfer failed."""
class NoTorError(WormholeError):
"""--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-08 07:45:11 +00:00
class OnlyOneCodeError(WormholeError):
"""Only one w.generate_code/w.set_code/w.type_code may be called"""
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."""