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

@@ -5,12 +5,12 @@ from django.core.exceptions import PermissionDenied
class JsonableError(Exception):
msg = None # type: Text
status_code = None # type: int
http_status_code = 400 # type: int
def __init__(self, msg, status_code=400):
# type: (Text) -> None
def __init__(self, msg, http_status_code=400):
# type: (Text, int) -> None
self.msg = msg
self.status_code = status_code
self.http_status_code = http_status_code
def __str__(self):
# type: () -> str