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: preserve and make error cause accessable #479

Merged
merged 2 commits into from
Aug 1, 2023
Merged

Conversation

pi0
Copy link
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

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