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

fix(base): define errorHandler with private not use # #3692

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented Nov 19, 2024

With this PR, defining errorHandler with private not using # in hono-base.ts:

private errorHandler: ErrorHandler = errorHandler

This will fix #3671

Since the property defined with # will be a completely private member that can't be accessed from outside in the JavaScript runtime phase, problem #3671 occurs. But, if you define it with private keyword without # it can be accessed from outside in the JavaScript runtime phase.

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

Copy link

Bundle size check

main (163657a) #3692 (b1c1f1c) +/-
Bundle Size 18,762B 18,822B 60B

Compiler Diagnostics

main (163657a) #3692 (b1c1f1c) +/-
Files 256 256 0
Lines 115,026 115,027 1
Identifiers 111,955 111,961 6
Symbols 243,453 243,453 0
Types 204,686 204,686 0
Instantiations 3,044,027 3,044,027 0
Memory used 429,461K 426,483K -2,978K
I/O read 0.02s 0.03s 0.01s
I/O write 0s 0s 0s
Parse time 0.7s 0.67s -0.03s
Bind time 0.33s 0.29s -0.04s
Check time 6.03s 5.76s -0.27s
Emit time 0s 0s 0s
Total time 7.07s 6.72s -0.35s

Reported by octocov

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.70%. Comparing base (163657a) to head (1238e64).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3692   +/-   ##
=======================================
  Coverage   91.70%   91.70%           
=======================================
  Files         159      159           
  Lines       10145    10145           
  Branches     2910     2973   +63     
=======================================
  Hits         9303     9303           
  Misses        840      840           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@yusukebe
Copy link
Member Author

@usualoma

Can you review this?

@usualoma
Copy link
Member

Hi @yusukebe, thank you 👍

Okay, so #3671 indicates that the problem is with apps that use a mixture of esm and cjs.
I'm not sure if this (mixing ems and cjs is OK) is within the scope of what Hono supports, but I think this change will fix it.

@yusukebe
Copy link
Member Author

@usualoma

I'm not sure if this (mixing ems and cjs is OK) is within the scope of what Hono supports

I'm also thinking about this thing! But currently, we have to accept this PR.

@yusukebe yusukebe merged commit 40ad5ee into main Nov 19, 2024
16 checks passed
@yusukebe yusukebe deleted the fix/errorhandler-private branch November 19, 2024 23:41
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.

Cannot access invalid private field 'app.#errorHandler'
2 participants