Skip to content

feat: preserve and make error cause accessable#479

Merged
pi0 merged 2 commits intomainfrom
feat/error-context
Aug 1, 2023
Merged

feat: preserve and make error cause accessable#479
pi0 merged 2 commits intomainfrom
feat/error-context

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented Aug 1, 2023

🔗 Linked issue

Resolves #377

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR improves H3Error class with a polyfill to support v8 error cause universally.

The createError wrapper also always provides input (or input.cause if provided) as cause so we can always access original error/object.

Another small fix: onError types fixed. It accepts an H3Error.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pi0 pi0 changed the title feat: preserve error cause feat: preserve and make error cause accessable Aug 1, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 1, 2023

Codecov Report

Merging #479 (7c0048b) into main (9a57a89) will increase coverage by 0.12%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
+ Coverage   80.01%   80.13%   +0.12%     
==========================================
  Files          27       27              
  Lines        3027     3036       +9     
  Branches      453      454       +1     
==========================================
+ Hits         2422     2433      +11     
+ Misses        605      603       -2     
Files Changed Coverage Δ
src/app.ts 97.95% <100.00%> (ø)
src/error.ts 80.44% <100.00%> (+1.03%) ⬆️

... and 1 file with indirect coverage changes

@pi0 pi0 merged commit 5ec4b30 into main Aug 1, 2023
@pi0 pi0 deleted the feat/error-context branch August 1, 2023 13:25
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.

Option to provide non-wrapped version of error (onError).

1 participant