Source code for simple_openid_connect.exceptions
"""
Exceptions that are raised at various parts of this library.
"""
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from simple_openid_connect.data import AuthenticationErrorResponse
[docs]
class OpenidProtocolError(Exception):
"""
A generic error that is raised when the OpenID protocol was irrecoverably violated
"""
[docs]
def __init__(self, msg: str, *data: Any) -> None:
super().__init__(msg, *data)
[docs]
class ImpossibleOperationError(OpenidProtocolError):
"""
This error indicates that an intended operation could not be performed because it is not possible under the current
configuration
"""
pass
[docs]
class UnsupportedByProviderError(OpenidProtocolError):
"""
This error indicates that a desired feature is not supported by the OpenID Provider
"""
pass
[docs]
class AuthenticationFailedError(Exception):
"""
A previous authentication attempt has failed
"""
[docs]
def __init__(self, error: "AuthenticationErrorResponse"):
super().__init__(error)
@property
def error(self) -> "AuthenticationErrorResponse":
value = self.args[0] # type: AuthenticationErrorResponse
return value
[docs]
class ValidationError(AssertionError):
"""
A validation failed
"""
[docs]
def __init__(self, msg: str):
super().__init__(msg)
@property
def msg(self) -> str:
value = self.args[0] # type: str
return value