jsonptr icon indicating copy to clipboard operation
jsonptr copied to clipboard

migrate remaining errors to new model

Open asmello opened this issue 9 months ago • 3 comments

The EncodingError and ParseIndexError types are parsing errors with a well defined 'subject', but they weren't previously made into Diagnostic implementors, so they worked a bit inconsistently with other error types. This PR makes it so those errors follow the same conventions and general structure used by its kindred.

There is one related breaking change: InvalidCharacterError previously held a copy of the subject, but in the new model this is a responsibility of its enriched Report<InvalidCharacterError> type. Since some methods directly depended on access to the subject, they had to be removed. I think this is justifiable since the new error APIs are already breaking (we just should've made this change in tandem with the other related breaks).

I don't have any other error-related breaks planned.

This PR also incidentally fixes an incorrect error type returned if the token ended with a ~ (it would be flagged as a slash error, not tilde). I updated tests to cover this.

asmello avatar Feb 18 '25 21:02 asmello

~TODO: update changelog~

asmello avatar Feb 18 '25 21:02 asmello

Codecov Report

Attention: Patch coverage is 92.41706% with 16 lines in your changes missing coverage. Please review.

Project coverage is 95.8%. Comparing base (b302568) to head (612634c). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/index.rs 88.0% 13 Missing :warning:
src/token.rs 96.9% 3 Missing :warning:
Additional details and impacted files
Files with missing lines Coverage Δ
src/assign.rs 97.6% <100.0%> (-0.1%) :arrow_down:
src/diagnostic.rs 77.9% <ø> (+3.4%) :arrow_up:
src/token.rs 98.7% <96.9%> (+1.0%) :arrow_up:
src/index.rs 91.2% <88.0%> (-1.0%) :arrow_down:
:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Feb 23 '25 20:02 codecov-commenter

Damnit, I really regret pushing 0.7. Agreed that it should have been bundled.

We can cut a 0.8 in short order i think. I doubt many will have picked up 0.7 already and the breaks slotted for it won't be that bad.

chanced avatar Feb 25 '25 15:02 chanced

Great changes and good catch! I kinda regret pushing the last release in haste - ah well.

I don't think we will be touching errors after this release so hopefully folks will forgive a bit of churn.

chanced avatar Jun 02 '25 23:06 chanced

Yeah, in a way it's good we took a while so the breaks aren't too close to each other. Although, yes, ideally we'd have bundled this one, but oh well.

asmello avatar Jun 08 '25 18:06 asmello