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
Throw a generic exception
if not provided, a code is generated with filename and method name (that raised the exception), defaults to None If can also be use for internationalisation (translating the detail message) For example : detail = 'Hello {{name}}' and detail_args = {"name" : "Bob"}, the message that will be show will be 'Hello bob' This is useful for internationalisation
Parameters:
Name | Type | Default value | Description |
---|---|---|---|
detail | str | Human redable message of the error :param detail_args: if provided, it replace the arg in the detail message (between double bracket {{}}) with the corresponding dict value, defaults to none :type detail_args: dict, optional | |
unique_code | str | Unique code to recognize the error, , optional | |
detail_args | Dict | If provided, it replace the arg in the detail message (between double bracket {{}}) with the corresponding dict value, defaults to none , optional | |
headers | Dict | If specific header need to be returned in the http response, defaults to none , optional | |
instance_id | str | Unique id for this exception instance. only provide when it was generated by another exception , optional |
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 |