utils: allow changing APIError attributes (#38721)

This commit is contained in:
Valentin Deniaud 2020-06-03 10:54:27 +02:00
parent ef12d99049
commit 47805fc808
1 changed files with 3 additions and 3 deletions

View File

@ -31,11 +31,11 @@ CALLBACK_NAME = getattr(settings, 'JSONRESPONSE_CALLBACK_NAME', 'callback')
class APIError(RuntimeError):
'''Exception to raise when there is a remote application or business logic error.'''
err = 1
log_error = False
http_status = 200
def __init__(self, *args, **kwargs):
self.err = kwargs.pop('err', 1)
self.log_error = kwargs.pop('log_error', False)
self.http_status = kwargs.pop('http_status', 200)
self.__dict__.update(kwargs)
super(APIError, self).__init__(*args)