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:
Greg Price
2017-07-19 16:23:12 -07:00
committed by Tim Abbott
parent 098b6fc53b
commit 6dfb46dc08
5 changed files with 12 additions and 15 deletions

View File

@@ -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)