Generic exception to throw a 403 forbidden error useful for any kind of error
Attributes
detail: str
detail_args: Dict
headers: Dict
instance_id: str
show_as: Literal
unique_code: str
Functions
__init__
Throw a generic exception
detail :
str
Human redable message of the error
unique_code :
str
Unique code to recognize the error,
if not provided, a code is generated with filename and method name (that raised the exception)
detail_args :
Dict
if provided, it replace the arg in the detail message (between double bracket {{}}) with the corresponding dict value
headers :
Dict
if specific header need to be returned in the HTTP response
instance_id :
str
Unique id for this exception instance. Only provide when it was generated by another exception
get_detail_with_args
Replace the arguments in the exception message with dict corresponding values For example : detail = 'Hello {{name}}' and detail_args = {"name" : "Bob"}, the message that will be show will be 'Hello bob'
Return type :
str