Source code for pyrebrandly.exceptions

[docs]class RebrandlyError(Exception): """ Base+Base Error """ pass
[docs]class Error(RebrandlyError): """ Base Error """ pass
[docs]class APIError(Error): """ Base API Error """ pass
[docs]class NotEnoughArgumentsError(APIError): """ Not Enough Arguments for method """ def __init__(self, *, func=None, args=None): self.func = func self.args = args def __repr__(self): return 'not enough arguments for {}, needed args: {}'.format(self.func, self.args)
[docs]class InvalidOptionsError(APIError): """ Invalid Options in Options dict() :exception InvalidOptionsError """ def __init__(self, *, possible=None, invalid=None): """ :rtype: object """ self.possible_opts = possible self.invalid_opts = invalid def __repr__(self): return 'invalid options used in dict, invalid: {}, possible: {}'.format(self.invalid_opts, self.possible_opts)
[docs]class BadRequestError(APIError): """ Invalid JSON Request Code: 400 """ pass
[docs]class NotAuthorizedError(APIError): """ Authorization credentials invalid oAuth Token expired etc. Code: 401 """ pass
[docs]class AlreadyExistsError(APIError): """ Link etc. Already Exists Code: 403 """ pass
[docs]class InvalidFormatError(APIError): """ Invalid input format Missing body Limits threshold reached Code: 403 """ pass
[docs]class NotFoundError(APIError): """ Resource/Endpoint not found Code: 404 """ pass
[docs]class InternalServerError(APIError): """ API Endpoint Server Error Code: 500 """ pass
[docs]class BadGatewayError(APIError): """ Failure in Rebrandly's upstream providers Code: 502 """ pass
[docs]class APIUnavailableError(APIError): """ API endpoint under maintenance Code: 503 """ pass
[docs]class APITimeoutError(APIError): """ API Operation Timeout Code: 504 """ pass