feat: structured decoding errors - #57
Merged
Merged
Conversation
…system Remove individual error classes (ArrayError, ObjectError, OneOfError, etc.) in favour of a unified structured DecodingIssue[] API. All schemas now emit composable, nestable issue objects instead of class instances. BREAKING CHANGE: All named error classes have been removed. Consumers that catch or instanceof-check specific error types must migrate to inspecting the DecodingIssue[] array on the resulting Err value.
Schemas (object, array, tuple, record, allOf) now collect every DecodingIssue before returning, so callers see the full picture in a single pass. oneOf returns the issues from the deepest partial match rather than a generic fallback message. Extracted prependPath helper to share path-prepending logic across schemas.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #57 +/- ##
==========================================
+ Coverage 96.87% 98.65% +1.77%
==========================================
Files 36 25 -11
Lines 288 297 +9
Branches 76 88 +12
==========================================
+ Hits 279 293 +14
+ Misses 9 4 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Major release reworking error handling.
Breaking changes
{ message, path }issues instead of a single string; all failures are reported at once, not just the first.object,array,oneOf,record,objectStrict) no longer take a name argument.parse()/decodePromise()now throw/rejectErrorobjects (.causeholds the issues).dictionary,failover,isExactly,chain,decodeToPromise.Docs
See the migration guide for upgrade steps.