Skip to content

fix(context): don't throw the error with c.header() when it's finalized #4078

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented Apr 15, 2025

Fixes #4055

This is based on #4055 (comment) by @usualoma. It is a "slightly overhead but simple" pattern. I think it's rare that it should catch the error with try/catch, so this simple implementation is better.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

…ized

Co-authored-by: Taku Amano <taku@taaas.jp>

This comment has been minimized.

Copy link

Bundle size check

main (b68da39) #4078 (a694dd4) +/-
Bundle Size (B) 18,976B 18,904B -72B
Bundle Size (KB) 18.53K 18.46K -0.07K

Compiler Diagnostics

main (b68da39) #4078 (a694dd4) +/-
Files 261 261 0
Lines 116,443 116,434 -9
Identifiers 114,436 114,428 -8
Symbols 303,844 303,852 8
Types 214,831 214,828 -3
Instantiations 3,091,594 3,091,594 0
Memory used 444,601K 453,098K 8,497K
I/O read 0.02s 0.03s 0.01s
I/O write 0s 0s 0s
Parse time 0.66s 0.79s 0.13s
Bind time 0.28s 0.33s 0.05s
Check time 5.51s 5.66s 0.15s
Emit time 0s 0s 0s
Total time 6.45s 6.78s 0.33s

Reported by octocov

Copy link

codecov bot commented Apr 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.33%. Comparing base (b68da39) to head (6745a6a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4078      +/-   ##
==========================================
+ Coverage   91.29%   91.33%   +0.03%     
==========================================
  Files         168      168              
  Lines       10774    10682      -92     
  Branches     3053     3143      +90     
==========================================
- Hits         9836     9756      -80     
+ Misses        937      925      -12     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yusukebe
Copy link
Member Author

yusukebe commented Apr 15, 2025

Hey @usualoma

I've made a PR based on your comment. I think "Slightly overhead but simple" is good. Can you review this?

@usualoma
Copy link
Member

Hi @yusukebe. Thank you. LGTM!

@yusukebe
Copy link
Member Author

@usualoma

Thanks! Merging.

@yusukebe yusukebe merged commit 4b20956 into main Apr 15, 2025
16 checks passed
@yusukebe yusukebe deleted the fix/context-dont-throw-error-c-header branch April 15, 2025 12:40
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.

Throwing immutable headers error with c.header() when the res is finalized
2 participants