jiter
jiter copied to clipboard
Custom Python exception with `kind` and `path`
We need a new exception that subclasses ValueError and adds a kind attribute which is the name from:
https://github.com/pydantic/jiter/blob/1fbedbfbcb86a767b9dd621d080f430528aebc33/crates/jiter/src/errors.rs#L6
and
https://github.com/pydantic/jiter/blob/1fbedbfbcb86a767b9dd621d080f430528aebc33/crates/jiter/src/errors.rs#L189
We also want:
- the path of the error, e.g.
['foo', 'bar', 0]- this should be opt in with (another) generic option, hopefully the last - the exact position of the error (as well as line and column number) this would allow the value that was rejected (e.g.
NaNin the case ofallow_nan_inf=False) to be extracted manually