You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
atlowChemi
added
errors
Issues and PRs related to JavaScript errors originated in Node.js core.
worker
Issues and PRs related to Worker support.
labels
Jul 9, 2023
* Track worker errors. They're not native due to nodejs/node#48716, but we want to treat them as such anyway.
* Only treat native errors as errors
* Remove is-error dependency
* Document edge case where `error instanceof Error` can be true, yet AVA does not recognize `error` as an error
See also #2911 for an earlier attempt.
Version
20.4.0
Platform
Darwin user 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64 arm Darwin
Subsystem
worker_threads
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always, as long as the error is emitted by the
error
event on the worker. Any errors sent viapostMessage()
are identified correctly.What is the expected behavior? Why is that the expected behavior?
types.isNativeError()
returnstrue
for the emitted error.What do you see instead?
types.isNativeError()
returnsfalse
for the emitted error.Additional information
The problem seems to be in the error deserialization:
node/lib/internal/error_serdes.js
Line 172 in eece8d7
Reading the code, I believe it's roughly equivalent to:
According to the spec, merely extending the error prototype does not create a native error.
Of course, because it does extend the Error prototype,
error instanceof Error
returnstrue
.I don't have the context for why the serialization is so complex, but FWIW the built-in
v8
serde does result in proper native error objects.The text was updated successfully, but these errors were encountered: