JsonableError: Make http_status_code a class attribute only.

This simplifies things for all codepaths not involving this feature.

Using this feature becomes slightly easier when you're already
defining a subclass, but now requires you to define a subclass.
Currently we use it just once out of >100 uses of JsonableError, and
that use already has a subclass, so this seems like a win.
This commit is contained in:
Greg Price
2017-07-20 17:06:40 -07:00
committed by Tim Abbott
parent 7cd621bc9d
commit 4837d4178d
2 changed files with 4 additions and 4 deletions

View File

@@ -7,10 +7,9 @@ class JsonableError(Exception):
msg = None # type: Text
http_status_code = 400 # type: int
def __init__(self, msg, http_status_code=400):
# type: (Text, int) -> None
def __init__(self, msg):
# type: (Text) -> None
self.msg = msg
self.http_status_code = http_status_code
def __str__(self):
# type: () -> str