temporalio / temporalio/sdk-typescript
[Feature Request] support AggregateError
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 917
- Forks
- 224
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 43
Description
Is your feature request related to a problem? Please describe.
In node.js as well as in web browsers one can declare errors like:
new AggregateError(
[
new Error("test error 1"),
new Error("test error 2", { cause: new Error("test error 3") }),
new Error("test error 4"),
],
"test error"
);
this is what that error looks like if you console.log it in node
Welcome to Node.js v20.11.1.
Type ".help" for more information.
> console.log(new AggregateError([ new Error("test error 1"), new Error("test error 2", { cause: new Error("test error 3") }), new Error("test error 4") ], "test error"))
AggregateError: test error
at REPL1:1:5
at ContextifyScript.runInThisContext (node:vm:121:12)
at REPLServer.defaultEval (node:repl:599:22)
at bound (node:domain:432:15)
at REPLServer.runBound [as eval] (node:domain:443:12)
at REPLServer.onLine (node:repl:929:10)
at REPLServer.emit (node:events:530:35)
at REPLServer.emit (node:domain:488:12)
at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)
at [_line] [as _line] (node:internal/readline/interface:887:18) {
[errors]: [
Error: test error 1
at REPL1:1:31
at ContextifyScript.runInThisContext (node:vm:121:12)
at REPLServer.defaultEval (node:repl:599:22)
at bound (node:domain:432:15)
at REPLServer.runBound [as eval] (node:domain:443:12)
at REPLServer.onLine (node:repl:929:10)
at REPLServer.emit (node:events:530:35)
at REPLServer.emit (node:domain:488:12)
at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)
at [_line] [as _line] (node:internal/readline/interface:887:18),
Error: test error 2
at REPL1:1:61
at ContextifyScript.runInThisContext (node:vm:121:12)
... 7 lines matching cause stack trace ...
at [_line] [as _line] (node:internal/readline/interface:887:18) {
[cause]: Error: test error 3
at REPL1:1:96
at ContextifyScript.runInThisContext (node:vm:121:12)
at REPLServer.defaultEval (node:repl:599:22)
at bound (node:domain:432:15)
at REPLServer.runBound [as eval] (node:domain:443:12)
at REPLServer.onLine (node:repl:929:10)
at REPLServer.emit (node:events:530:35)
at REPLServer.emit (node:domain:488:12)
at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)
at [_line] [as _line] (node:internal/readline/interface:887:18)
},
Error: test error 4
at REPL1:1:129
at ContextifyScript.runInThisContext (node:vm:121:12)
at REPLServer.defaultEval (node:repl:599:22)
at bound (node:domain:432:15)
at REPLServer.runBound [as eval] (node:domain:443:12)
at REPLServer.onLine (node:repl:929:10)
at REPLServer.emit (node:events:530:35)
at REPLServer.emit (node:domain:488:12)
at [_onLine] [as _onLine] (node:internal/readline/interface:416:12)
at [_line] [as _line] (node:internal/readline/interface:887:18)
]
}
Describe the solution you'd like
Would be amazing if temporal extracted and stored child errors of the AggregateError, right now it supports only single child in cause.
or at least include stack traces of children in the stack trace of the top error using something like require("util").inspect(exception, { showHidden: false, depth: null, colors: false }) (note the stack tracing fixing function that cuts off internal calls from trace should be adopted to not cut things off in this format)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests; start by locating Temporal's existing single-cause extraction and the stack-trace fixing function mentioned in the request. Compare current behavior with Node.js and browser AggregateError output, then add coverage showing child errors are preserved or represented in the top stack.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, typescript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100