backend.components.camera_verification.error_handling.errorService
1from backend.components.camera_verification.error_handling.errorConfig import ( 2 EXCEPTION_MAP, 3 ErrorResponse 4) 5 6def verification_response_handler(e: Exception|None = None) -> ErrorResponse: 7 """ 8 Handles passed verification response (Exception?). Returns respective error code, error message and whether to log the event. 9 10 **Parameters**: 11 - `e` (Exception|None): Exception if one was caught, if no exception was caught this parameter can be None. 12 13 **Returns**: 14 - `ErrorResponse` - Response object with decisions and additional info for the back-end. 15 """ 16 try: 17 response = EXCEPTION_MAP[type(e)] 18 except KeyError: 19 response = EXCEPTION_MAP[Exception] 20 response.message += str(e) 21 22 return response
def
verification_response_handler( e: Exception | None = None) -> backend.components.camera_verification.error_handling.errorConfig.ErrorResponse:
7def verification_response_handler(e: Exception|None = None) -> ErrorResponse: 8 """ 9 Handles passed verification response (Exception?). Returns respective error code, error message and whether to log the event. 10 11 **Parameters**: 12 - `e` (Exception|None): Exception if one was caught, if no exception was caught this parameter can be None. 13 14 **Returns**: 15 - `ErrorResponse` - Response object with decisions and additional info for the back-end. 16 """ 17 try: 18 response = EXCEPTION_MAP[type(e)] 19 except KeyError: 20 response = EXCEPTION_MAP[Exception] 21 response.message += str(e) 22 23 return response
Handles passed verification response (Exception?). Returns respective error code, error message and whether to log the event.
Parameters:
e(Exception|None): Exception if one was caught, if no exception was caught this parameter can be None.
Returns:
ErrorResponse- Response object with decisions and additional info for the back-end.