"""Exception classes used in pwned-passwords-django."""# SPDX-License-Identifier: BSD-3-Clauseimportenum
[docs]classErrorCode(str,enum.Enum):""" Enum of possible error code values for :exc:`PwnedPasswordsError`. """API_TIMEOUT="api_timeout"HTTP_ERROR="http_error"REQUEST_ERROR="request_error"UNKNOWN_ERROR="unknown_error"
[docs]classPwnedPasswordsError(Exception):""" Wrapper for all exceptions raised in communicating with Pwned Passwords. """def__init__(self,message:str,code:ErrorCode,params:dict)->None:super().__init__(message,code,params)self.message=messageself.code=codeself.params=params