pysimdjson
pysimdjson copied to clipboard
Properly populate JSONDecodeError & UnicodeDecodeError
We currently raise a ValueError instead of JSONDecodeError (which is a ValueError subclass) in some cases where JSONDecodeError would be more appropriate. This is because upstream simdjson does not report errors with enough granularity to populate lineno
and colno
(https://docs.python.org/3/library/json.html#json.JSONDecodeError)
Might be viable to return 0 and 0 for now?
Please ping issue https://github.com/simdjson/simdjson/issues/237
This is not a fundamental limitation and it is simply a matter of doing the coding.
We have the same issue with UnicodeDecodeError
here https://github.com/TkTech/pysimdjson/blob/master/simdjson/binding.cpp#L227. However, very few projects I could find seem to care about the additional properties, and those that do use the error in such a way that they would just see a blank string rather than a crash.