lbry-sdk/lbrynet/core/Error.py

138 lines
2.7 KiB
Python
Raw Normal View History

2015-08-20 17:27:15 +02:00
class PriceDisagreementError(Exception):
pass
class DuplicateStreamHashError(Exception):
pass
class DownloadCanceledError(Exception):
pass
class DownloadTimeoutError(Exception):
def __init__(self, download):
Exception.__init__(self, 'Failed to download {} within timeout'.format(download))
self.download = download
2015-08-20 17:27:15 +02:00
class RequestCanceledError(Exception):
pass
class NegativeFundsError(Exception):
pass
class NullFundsError(Exception):
pass
2015-08-20 17:27:15 +02:00
class InsufficientFundsError(Exception):
pass
class ConnectionClosedBeforeResponseError(Exception):
pass
class KeyFeeAboveMaxAllowed(Exception):
pass
2017-02-28 02:18:57 +01:00
class InvalidExchangeRateResponse(Exception):
def __init__(self, source, reason):
Exception.__init__(self, 'Failed to get exchange rate from {}:{}'.format(source, reason))
self.source = source
self.reason = reason
2015-08-20 17:27:15 +02:00
class UnknownNameError(Exception):
def __init__(self, name):
Exception.__init__(self, 'Name {} is unknown'.format(name))
2015-08-20 17:27:15 +02:00
self.name = name
2017-06-09 19:39:55 +02:00
class UnknownClaimID(Exception):
def __init__(self, claim_id):
Exception.__init__(self, 'Claim {} is unknown'.format(claim_id))
self.claim_id = claim_id
class UnknownURI(Exception):
def __init__(self, uri):
Exception.__init__(self, 'URI {} cannot be resolved'.format(uri))
self.name = uri
class InvalidName(Exception):
def __init__(self, name, invalid_characters):
2016-07-29 00:48:29 +02:00
self.name = name
self.invalid_characters = invalid_characters
Exception.__init__(
self, 'URI contains invalid characters: {}'.format(','.join(invalid_characters)))
2016-07-29 00:48:29 +02:00
class UnknownStreamTypeError(Exception):
def __init__(self, stream_type):
self.stream_type = stream_type
def __str__(self):
return repr(self.stream_type)
class InvalidStreamDescriptorError(Exception):
pass
2015-08-20 17:27:15 +02:00
class InvalidStreamInfoError(Exception):
def __init__(self, name, stream_info):
2016-11-04 21:09:40 +01:00
msg = '{} has claim with invalid stream info: {}'.format(name, stream_info)
Exception.__init__(self, msg)
2015-08-20 17:27:15 +02:00
self.name = name
self.stream_info = stream_info
2015-08-20 17:27:15 +02:00
class MisbehavingPeerError(Exception):
pass
class InvalidDataError(MisbehavingPeerError):
pass
class NoResponseError(MisbehavingPeerError):
pass
class InvalidResponseError(MisbehavingPeerError):
pass
class NoSuchBlobError(Exception):
pass
class NoSuchStreamHash(Exception):
pass
class NoSuchSDHash(Exception):
"""
Raised if sd hash is not known
"""
class InvalidBlobHashError(Exception):
pass
class InvalidHeaderError(Exception):
pass
class InvalidAuthenticationToken(Exception):
2016-09-22 03:36:06 +02:00
pass
class NegotiationError(Exception):
pass