mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
JsonableError: Rename status_code and rely more on its default.
With #5598 there will soon be an application-level error code optionally associated with a `JsonableError`, so rename this field to make clear that it specifically refers to an HTTP status code. Also take this opportunity to eliminate most of the places that refer to it, which only do so to repeat the default value.
This commit is contained in:
@@ -286,7 +286,7 @@ class JsonErrorHandler(MiddlewareMixin):
|
||||
def process_exception(self, request, exception):
|
||||
# type: (HttpRequest, Exception) -> Optional[HttpResponse]
|
||||
if isinstance(exception, JsonableError):
|
||||
return json_error(exception.to_json_error_msg(), status=exception.status_code)
|
||||
return json_error(exception.to_json_error_msg(), status=exception.http_status_code)
|
||||
if request.error_format == "JSON":
|
||||
logging.error(traceback.format_exc())
|
||||
return json_error(_("Internal server error"), status=500)
|
||||
|
||||
Reference in New Issue
Block a user