Rename BAD_JSON -> JSON_PARSE_ERROR.

I intend to prefix JSON related errors with 'JSON'.
This commit is contained in:
Max Goodman
2013-07-17 15:24:13 -07:00
parent e03cb367d3
commit e195ee0706
2 changed files with 3 additions and 3 deletions

View File

@@ -128,7 +128,7 @@ error_list = dict((
('MULTI_CANNOT_EDIT', _('you can\'t change that multireddit')),
('MULTI_TOO_MANY_SUBREDDITS', _('no more space for subreddits in that multireddit')),
('MULTI_SPECIAL_SUBREDDIT', _("can't add special subreddit %(path)s")),
('BAD_JSON', _('unable to parse JSON data')),
('JSON_PARSE_ERROR', _('unable to parse JSON data')),
))
errors = Storage([(e, e) for e in error_list.keys()])

View File

@@ -2183,12 +2183,12 @@ class VPermissions(Validator):
class VJSON(Validator):
def run(self, json_str):
if not json_str:
return self.set_error('BAD_JSON', code=400)
return self.set_error('JSON_PARSE_ERROR', code=400)
else:
try:
return json.loads(json_str)
except ValueError:
return self.set_error('BAD_JSON', code=400)
return self.set_error('JSON_PARSE_ERROR', code=400)
def param_docs(self):
return {