-
-
Notifications
You must be signed in to change notification settings - Fork 377
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: httpErrorHandler minification type checking #337
Conversation
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 20 20
Lines 542 543 +1
Branches 110 110
=====================================
+ Hits 542 543 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 20 20
Lines 543 543
Branches 111 111
=====================================
Hits 543 543
Continue to review full report at Codecov.
|
This cant be merged until both jshttp/http-errors#56 and npm/npm#19770 have been resolved. I guess thats why it was done in the current way. |
Given the only thing used by the response is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, thanks @chrisandrews7!
I initially didn't like the solution to check the statusCode
(I was more inclined to a check like instanceof HttError
), but after thinking a bit more about it, I think it's simple enough and it might work in most cases, even if a custom middleware doesn't want to return an actual instance of HttpError
.
I'll try to get this merged shortly, can you submit the same change for v1.0.0-alpha? :)
I actually added an extra check for I think I have enough time to forward port this to 1.0.0 |
If the code is mangled during minification process when using webpack, the check for a type of
HttpError
in the httpErrorHandler middleware will fail. As the private property onsuper_.name
will not beHttpError
, the mangling would change the name.This is due to Terser setting both
keep_classnames
andkeep_fnames
to false by default.Either way it shouldn't really use a private property to check the type of error.
This will close #325