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

Consider merging all error types into sfv::Error #148

Closed
apasel422 opened this issue Mar 11, 2025 · 0 comments · Fixed by #149
Closed

Consider merging all error types into sfv::Error #148

apasel422 opened this issue Mar 11, 2025 · 0 comments · Fixed by #149
Assignees

Comments

@apasel422
Copy link
Collaborator

apasel422 commented Mar 11, 2025

It's unclear if having separate DecimalError, KeyError, TokenError, StringError, and OutOfRangeError types is actually useful. All of these correspond to cases in which data is being converted into an sfv type, the majority of which will occur during serialization, which is already fallible for lists and dictionaries, which return sfv::Error to indicate this.

Having a common error type (i.e. using sfv::Error for all of these) makes it a bit easier to propagate them without falling back to Box<dyn std::error::Error> or a user-defined enum.

See https://docs.rs/jiff/latest/jiff/struct.Error.html#design for related discussion of this pattern.

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