Source code for rt.exceptions
"""Exceptions collection for the rt library."""
[docs]class RtError(Exception):
""" Super class of all Rt Errors """
[docs]class AuthorizationError(RtError):
""" Exception raised when module cannot access :term:`API` due to invalid
or missing credentials. """
[docs]class NotAllowed(RtError):
""" Exception raised when request cannot be finished due to
insufficient privileges. """
[docs]class UnexpectedResponse(RtError):
""" Exception raised when unexpected HTTP code is received. """
[docs]class APISyntaxError(RtError):
""" Exception raised when syntax error is received. """
[docs]class InvalidUse(RtError):
""" Exception raised when API method is not used correctly. """
[docs]class BadRequest(RtError):
""" Exception raised when HTTP code 400 (Bad Request) is received. """
[docs]class ConnectionError(RtError):
""" Encapsulation of various exceptions indicating network problems. """
def __init__(self, message: str, cause: Exception) -> None:
""" Initialization of exception extented by cause parameter.
:keyword message: Exception details
:keyword cause: Cause exception
"""
super().__init__(message + ' (Caused by ' + repr(cause) + ")")
self.cause = cause
[docs]class InvalidQueryError(RtError):
""" Exception raised when attempting to search RT with an invalid raw query. """