| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@joyeecheung build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/702/pipeline |
Sorry, something went wrong.
|
Also for context on why we use our internal error system for the URL errors: #11299 |
Sorry, something went wrong.
|
There was also a discussion about restoring the behavior of error.name (couldn't find the link...cc @BridgeAR ?) I think we decided to keep them as-is. I haven't dug into the spec to see if we have to leave error.name alone, but I am guessing this is unspecified, so this patch is just a hack for the WPT harness. |
Sorry, something went wrong.
|
or...maybe we have to leave the error names alone, at least for errors thrown from Web APIs :/ Refs: https://heycam.github.io/webidl/#dfn-exception-error-name
|
Sorry, something went wrong.
|
Not really a fan of this and really prefer to leave the internal/error names as they are currently. However, if this is just for testing, then definitely won't block |
Sorry, something went wrong.
@jasnell Yeah this is just a hack for testing with the WPT harness directly instead of using our mocks. I am not entirely sure if it's technically a bug in our implementation (which means we need to fix it for users), or just a quirk that we need to deal with if we want to use the WPT harness in our own tests though, but it doesn't harm to have a workaround before we figure that out |
Sorry, something went wrong.
There was a problem hiding this comment.
Instead of adding the useOriginalName couldn't you create a new error helper for more Web Platform related errors separate from the makeNodeErrorWithCode one?
Sorry, something went wrong.
There was a problem hiding this comment.
@jdalton I would if we decide to leave the names alone for those errors...but doesn't seem to worth it if it's just to work around the WPT harness and it's only for testing
Sorry, something went wrong.
There was a problem hiding this comment.
@joyeecheung Is it just a test harness thing are is the WPT fail hinting that URL errors should not have custom name's other than those of the builtin errors? If it means URL is not spec compliant then it's an issue for Node. If it is unspec'd then a bug should be filed for WPT.
Sorry, something went wrong.
There was a problem hiding this comment.
See #11299 If you feel strongly about this feel free to reopen that issue or open a new one. If we were to fix that, it has to be semver-major. This PR is just a work around so that we can update the tests without a semver-major change - I would rather not label a bunch of upcoming test update with semver-major and make them a backport burden.
Sorry, something went wrong.
There was a problem hiding this comment.
Changing user accessible error APIs is not the answer here.
Sorry, something went wrong.
@jdalton Can you elaborate on your reasoning behind this? We have been exposing user-accessible APIs - albeit internals that are behind flags - to facilitate testing, like the errors.E that have already existed for quite some time, which is exported together with errors.useOriginalName. It seems out of scope to debate whether we should make internal testing utilities (behind flags) accessible to users here. |
Sorry, something went wrong.
|
This is a test harness concern and not worth moving into exposed APIs. I've given you a path forward that doesn't involving touching Node error APIs. Depending on where the fault is you can file a bug on WPT or work with Node to correct its errors. If it requires a major bump for Node then so be it. The WPT tests can be held until then. |
Sorry, something went wrong.
|
@joyeecheung the issue is #20253. I only found a single way to consistently adding the error code to the stack trace while keeping the name as is: directly after creating the error (or on creation) the name is set to err.name + ' [ERROR_CODE]', then the stack is accessed, the error name is reset to the original name and the error is returned... this however is a significant performance issue in case the error stack would not be accessed (but accessing the stack is normal when receiving an error, so that should be rare) and the prepareStackTrace function could not be used on received errors (this is something the user can not always expect though as the stack might already have been accessed somewhere in-between). Other than that, the current implementation is AFAIK the only one possible. |
Sorry, something went wrong.
There was a problem hiding this comment.
this looks a-okay to me ![]()
Sorry, something went wrong.
There was a problem hiding this comment.
Since this is internal, I am fine with it for now. We can still revise the solution if we find something better.
So LGTM.
Sorry, something went wrong.
I would agree if this is a public API, but it is an internal API that is only accessible with the --expose-internals flag. As unfortunate as it is, altering internal APIs for test harness concerns is an established practice - searching for // Flags: --expose-internals under test yields 118 results on master. EDIT: it appears I was on a outdated branch...the current number of Flags: --expose-internals under test is 156 |
Sorry, something went wrong.
There was a problem hiding this comment.
Oh I see. I misunderstood where the useOriginalName getter/setters lived.
Sorry, something went wrong.
IMHO that's A Ok. At least for unit testing. Being able to "mock out" parts of the system is very important for predictable testing. |
Sorry, something went wrong.
|
P.S. I know I'm late to tha party, but what is the purpose of this change? |
Sorry, something went wrong.
There was a problem hiding this comment.
Could you add this This allows us to tell the type of the errors without using instanceof, which is necessary in WPT harness. to the comment.
Sorry, something went wrong.
This allows us to tell the type of the errors without using instanceof, which is necessary in WPT harness.
|
I am going to land this tomorrow if there are no more comments etc. |
Sorry, something went wrong.
Thank you for following up. |
Sorry, something went wrong.
This allows us to tell the type of the errors without using instanceof, which is necessary in WPT harness. PR-URL: #22556 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com>
This allows us to tell the type of the errors without using instanceof, which is necessary in WPT harness. PR-URL: #22556 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com>
This allows us to tell the type of the errors without using instanceof, which is necessary in WPT harness. PR-URL: #22556 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com>
This allows us to tell the type of the errors without using instanceof, which is necessary in WPT harness. PR-URL: #22556 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Refael Ackermann <refack@gmail.com>
| Back | FazBrowse Home | New Git URL |
This allows us to tell the type of the errors without using
instanceof, which is necessary in WPT harness.
Checklist