Regress trailing comma modification and enhance error message

This commit is contained in:
Aaron Tan
2017-06-14 16:06:42 -04:00
parent 422950f45d
commit 96d491fdce
2 changed files with 1 additions and 37 deletions

View File

@@ -62,9 +62,4 @@ class JSONParser(parsers.JSONParser):
raise ParseError(_('JSON parse error - not a JSON object'))
return obj
except ValueError as exc:
try:
# PyYAML can also parse JSON-style input string, and support more flexible
# input grammar like trailing commas.
return yaml.load(data, OrderedDictLoader)
except Exception:
raise ParseError(_('JSON parse error - %s') % six.text_type(exc))
raise ParseError(_('JSON parse error - %s\nPossible cause: trailing comma.' % six.text_type(exc)))