Back to bricks list
Introduction Version

ForbiddenException

Generic exception to throw a 403 forbidden error useful for any kind of error

Attributes

detail: strdetail_args: Dictheaders: Dictinstance_id: strshow_as: Literalunique_code: str

Functions

__INIT__

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:
NameTypeDefault valueDescription
detailstr 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_codestr Unique code to recognize the error, , optional
detail_argsDict If provided, it replace the arg in the detail message (between double bracket {{}}) with the corresponding dict value, defaults to none , optional
headersDict If specific header need to be returned in the http response, defaults to none , optional
instance_idstr Unique id for this exception instance. only provide when it was generated by another exception , optional
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