notif-users/re2oapi/re2oapi/exceptions.py
Arthur Grisel-Davy ac3e5414fe Commit initial
2018-08-05 15:08:58 +02:00

27 lines
778 B
Python

class APIClientGenericError(ValueError):
template = "{}"
def __init__(self, *data):
self.data = data
self.message = self.template.format(*data)
super(APIClientGenericError, self).__init__(self.message)
class InvalidCredentials(APIClientGenericError):
template = "The credentials for {}@{} are not valid."
class PermissionDenied(APIClientGenericError):
template = "The {} request to '{}' was denied for {}."
class TokenFileNotFound(APIClientGenericError):
template = "Token file at {} not found."
class TokenFileNotReadable(APIClientGenericError):
template = "Token file at {} is not a JSON readable file."
class TokenNotInTokenFile(APIClientGenericError):
template = "Token for {}@{} not found in token file ({})."