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

feat(de): Track spans in errors #430

Merged
merged 12 commits into from
Jan 12, 2023
Merged

feat(de): Track spans in errors #430

merged 12 commits into from
Jan 12, 2023

Conversation

epage
Copy link
Member

@epage epage commented Jan 12, 2023

The caller can ask for the span and we report it in the error messages. This does come with a regression when an error does not originate from a toml string.

This had no discernible performance impact.

Fixes #303

epage added 12 commits January 11, 2023 21:15
I originally didn't do this as there isn't really anything to reference
for a table but the keys and I didn't think it'd be too helpful for a
`toml_edit::Table` API.  However, I'd like to have spans for every serde
error, so here we are.
In theory, everything boilds down to being a key or an item, so we only
need to explicitly add missing spans in those cases.

We'll see what reports we get from users on this.
The downside to this is we do not always have enough information to
print the span and we lost the ability to instead say the key.  I'm
assuming that is minor enough of a case to not be a problem.
@epage epage merged commit 205859f into toml-rs:main Jan 12, 2023
@epage epage deleted the error branch January 12, 2023 18:23
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 this pull request may close these issues.

Support reporting line/column in serialization errors
1 participant