Login
Back to bricks list
Introduction Version

BadRequestException

Generic exception to throw a 400 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 If info, in info box. , defaults to 'error'

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
show_asLiteral error Mode to show the error in the interface, if error it will be showed in an error box.
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