From e195ee070665fc170edce9ca8b5f0f71f7ab420a Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Wed, 17 Jul 2013 15:24:13 -0700 Subject: [PATCH] Rename BAD_JSON -> JSON_PARSE_ERROR. I intend to prefix JSON related errors with 'JSON'. --- r2/r2/lib/errors.py | 2 +- r2/r2/lib/validator/validator.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/r2/r2/lib/errors.py b/r2/r2/lib/errors.py index 291b4efe4..f7cece0ff 100644 --- a/r2/r2/lib/errors.py +++ b/r2/r2/lib/errors.py @@ -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()]) diff --git a/r2/r2/lib/validator/validator.py b/r2/r2/lib/validator/validator.py index 1c7aa9a13..233a83d15 100644 --- a/r2/r2/lib/validator/validator.py +++ b/r2/r2/lib/validator/validator.py @@ -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 {