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
This removes original errors that have been wrapped using cause, as seen below.
$ node
Welcome to Node.js v18.20.4.
Type ".help" for more information.
> (new Error("foo", { cause: new Error("bar") })).stack
'Error: foo\n' +
' at REPL1:1:2\n' +
' at ContextifyScript.runInThisContext (node:vm:121:12)\n' +
' at REPLServer.defaultEval (node:repl:599:22)\n' +
' at bound (node:domain:433:15)\n' +
' at REPLServer.runBound [as eval] (node:domain:444:12)\n' +
' at REPLServer.onLine (node:repl:929:10)\n' +
' at REPLServer.emit (node:events:529:35)\n' +
' at REPLServer.emit (node:domain:489:12)\n' +
' at [_onLine] [as _onLine] (node:internal/readline/interface:423:12)\n' +
' at [_line] [as _line] (node:internal/readline/interface:894:18)'
I propose that you use util.inspect or something similar, to preserve this information, like seen below.
$ node
Welcome to Node.js v18.20.4.
Type ".help" for more information.
> util.inspect(new Error("foo", { cause: new Error("bar") }))
'Error: foo\n' +
' at REPL1:1:14\n' +
' at ContextifyScript.runInThisContext (node:vm:121:12)\n' +
' ... 7 lines matching cause stack trace ...\n' +
' at [_line] [as _line] (node:internal/readline/interface:894:18) {\n' +
' [cause]: Error: bar\n' +
' at REPL1:1:40\n' +
' at ContextifyScript.runInThisContext (node:vm:121:12)\n' +
' at REPLServer.defaultEval (node:repl:599:22)\n' +
' at bound (node:domain:433:15)\n' +
' at REPLServer.runBound [as eval] (node:domain:444:12)\n' +
' at REPLServer.onLine (node:repl:929:10)\n' +
' at REPLServer.emit (node:events:529:35)\n' +
' at REPLServer.emit (node:domain:489:12)\n' +
' at [_onLine] [as _onLine] (node:internal/readline/interface:423:12)\n' +
' at [_line] [as _line] (node:internal/readline/interface:894:18)\n' +
'}'
Why is this needed?
To preserve potentially important information.
Other
No response
The text was updated successfully, but these errors were encountered:
badeball
added a commit
to badeball/cypress-cucumber-preprocessor
that referenced
this issue
Sep 22, 2024
Additionally, for users that haven't enabled messages, one is generated
anyway in the users temporary location. This will hopefully shed some
light onto a previously reported and hard-to-reproduce issue [1].
I would ideally have liked to use error cause for this, but Cypress will
swallow this [2].
[1] #1161
[2] cypress-io/cypress#30265
badeball
added a commit
to badeball/cypress-cucumber-preprocessor
that referenced
this issue
Sep 24, 2024
Additionally, for users that haven't enabled messages, one is generated
anyway in the users temporary location. This will hopefully shed some
light onto a previously reported and hard-to-reproduce issue [1].
I would ideally have liked to use error cause for this, but Cypress will
swallow this [2].
[1] #1161
[2] cypress-io/cypress#30265
What would you like?
It seems like
Error.prototype.stack
is used to print errors originating from a plugin event handler, ref.https://github.com/cypress-io/cypress/blob/v13.14.2/packages/errors/src/errors.ts#L1380
.. and
https://github.com/cypress-io/cypress/blob/v13.14.2/packages/errors/src/errTemplate.ts#L321
This removes original errors that have been wrapped using
cause
, as seen below.I propose that you use
util.inspect
or something similar, to preserve this information, like seen below.Why is this needed?
To preserve potentially important information.
Other
No response
The text was updated successfully, but these errors were encountered: