Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Python exception with kind and path #99

Open
samuelcolvin opened this issue May 20, 2024 · 1 comment · May be fixed by #115
Open

Custom Python exception with kind and path #99

samuelcolvin opened this issue May 20, 2024 · 1 comment · May be fixed by #115

Comments

@samuelcolvin
Copy link
Member

samuelcolvin commented May 20, 2024

We need a new exception that subclasses ValueError and adds a kind attribute which is the name from:

pub enum JsonErrorType {

and

pub enum JiterErrorType {

@samuelcolvin
Copy link
Member Author

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. NaN in the case of allow_nan_inf=False) to be extracted manually

@samuelcolvin samuelcolvin changed the title Python exceptions should have a type attribute Python exceptions should have a kind attribute and path May 29, 2024
@samuelcolvin samuelcolvin changed the title Python exceptions should have a kind attribute and path Custom Python exception with kind and path May 29, 2024
@samuelcolvin samuelcolvin linked a pull request Jun 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant