mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +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:
@@ -11,18 +11,16 @@ from django.utils.translation import ugettext as _
|
||||
from zerver.lib.exceptions import JsonableError
|
||||
|
||||
class RequestVariableMissingError(JsonableError):
|
||||
def __init__(self, var_name, status_code=400):
|
||||
def __init__(self, var_name):
|
||||
self.var_name = var_name
|
||||
self.status_code = status_code
|
||||
|
||||
def to_json_error_msg(self):
|
||||
return _("Missing '%s' argument") % (self.var_name,)
|
||||
|
||||
class RequestVariableConversionError(JsonableError):
|
||||
def __init__(self, var_name, bad_value, status_code=400):
|
||||
def __init__(self, var_name, bad_value):
|
||||
self.var_name = var_name
|
||||
self.bad_value = bad_value
|
||||
self.status_code = status_code
|
||||
|
||||
def to_json_error_msg(self):
|
||||
return (_("Bad value for '%(var_name)s': %(value)s") %
|
||||
|
||||
Reference in New Issue
Block a user