Login
Back to bricks list
Introduction Version

ExceptionHandler

Class to handle exceptions and return a formatted object to the front

Functions

GENERATE_INSTANCE_ID - @classmethod
Return type:
str
GENERATE_UNIQUE_CODE_FROM_EXCEPTION - @classmethod

Generate a unique exception code from the stack trace

Return type:
str
GET_UNIQUE_CODE_FOR_BRICK - @classmethod

Convert the code to a unique code by adding the brick name before the code

Parameters:
NameTypeDefault valueDescription
codestr Exception code
Return type:
str
HANDLE_EXCEPTION - @classmethod
Parameters:
NameTypeDefault valueDescription
requestRequest
exceptionException
Return type:
ExceptionResponse
HANDLE_REQUEST_VALIDATION_ERROR - @classmethod

Handle a RequestValidationError exception (error 422 Unprocessable Entity) It returns only the first message

Parameters:
NameTypeDefault valueDescription
excRequestValidationError
UNIQUE_CODE_SEPARATOR - @classmethod
Return type:
str