From 59af4cdd8428dc3fcd0d2bcb14a38cf56166ca5b Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Wed, 3 Jun 2020 10:54:27 +0200 Subject: [PATCH 1/2] utils: allow changing APIError attributes (#38721) --- passerelle/utils/jsonresponse.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/passerelle/utils/jsonresponse.py b/passerelle/utils/jsonresponse.py index 3b9062ef..c0a17995 100644 --- a/passerelle/utils/jsonresponse.py +++ b/passerelle/utils/jsonresponse.py @@ -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): + def __init__(self, *args, err=1, log_error=False, http_status=200, **kwargs): + self.err = err + self.log_error = log_error + self.http_status = http_status self.__dict__.update(kwargs) super(APIError, self).__init__(*args) -- 2.20.1