[New-bugs-announce] [issue19361] Specialize exceptions thrown by JSON parser

Utkarsh Upadhyay report at bugs.python.org
Wed Oct 23 13:22:14 CEST 2013


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 <report at bugs.python.org>
<http://bugs.python.org/issue19361>
_______________________________________


More information about the New-bugs-announce mailing list