New submission from Utkarsh Upadhyay:

The JSON parser currently throws exceptions which contain information about 
where the error happened but this information is encoded in a string and not 
available to the programmer. This leads to issues like this: 
http://stackoverflow.com/questions/19519409/how-to-get-error-location-from-json-loads-in-python

Would it be a problem if the errors thrown were specialized exceptions, e.g. 
JSONParsingError, which has ValueError as a base class with these details (line 
number, char number, etc.) exposed as public members? The changes required seem 
to be limited to changing 
http://hg.python.org/cpython/file/4c4f31a1b706/Lib/json/decoder.py and the 
related documentation.

----------
components: Extension Modules
messages: 201015
nosy: musically_ut
priority: normal
severity: normal
status: open
title: Specialize exceptions thrown by JSON parser
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19361>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to