Skip to content

feat: structured decoding errors - #57

Merged
joanllenas merged 14 commits into
masterfrom
errors-revamp
Jun 10, 2026
Merged

feat: structured decoding errors#57
joanllenas merged 14 commits into
masterfrom
errors-revamp

Conversation

@joanllenas

Copy link
Copy Markdown
Owner

Description

Major release reworking error handling.

Breaking changes

  • Errors are now structured { message, path } issues instead of a single string; all failures are reported at once, not just the first.
  • Decoders (object, array, oneOf, record, objectStrict) no longer take a name argument.
  • parse() / decodePromise() now throw/reject Error objects (.cause holds the issues).
  • Removed deprecated aliases: dictionary, failover, isExactly, chain, decodeToPromise.

Docs

See the migration guide for upgrade steps.

joanllenas added 14 commits June 7, 2026 22:05
…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

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (f481b2b) to head (ac0cc22).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joanllenas
joanllenas merged commit b2d991c into master Jun 10, 2026
4 checks passed
@joanllenas
joanllenas deleted the errors-revamp branch June 10, 2026 21:28
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.

1 participant