I have two workflows, parent and child. The child workflow calls certain activities that error with a specific error message. As such, sometimes the child workflow will fail due to these errors. However, the error that the parent workflow receives from the child workflow failing does not contain the relevant error message. Is there anyway that I can get this to work as intended?
For context I’m on Temporal typescript sdk version 1.4.3.
As an example code block
parent workflow:
try {
const result = await executeChild(childWorkflow);
} catch (err) {
await activities.reportError(err);
}
childWorkflow:
await activity.trySomething();
activities:
async function trySomething():
throw Error('Trying to extract this specific text')
It seems like my childWorkflow (based on the Temporal UI), will get something, as an event of ActivityTaskFailed
.
{
"message": "Trying to extract this specific text",
"source": "TypeScriptSDK",
"stackTrace": "Trying to extract this specific text at Activity...",
"cause": null,
"applicationFailureInfo": {
"type": "TypeError",
"nonRetryable": false,
"details": null
}
}
What I see in the Temporal UI as the last event (which is WorkflowExecutionFailed
)
{
"message": "Activity execution failed",
"source": "TypeScriptSDK",
"stackTrace": "",
"cause": null,
"applicationFailureInfo": {
"type": "ActivityFailure",
"nonRetryable": false,
"details": null
}
}
and what’s in the results window of the child workflow is
{
"type": "workflowExecutionFailedEventAttributes",
"failure": {
"message": "Activity execution failed",
"source": "TypeScriptSDK",
"stackTrace": "",
"cause": null,
"applicationFailureInfo": {
"type": "ActivityFailure",
"nonRetryable": false,
"details": null
}
},
"retryState": "RetryPolicyNotSet",
"workflowTaskCompletedEventId": "10",
"newExecutionRunId": ""
}
Lastly what’s returned to the parent workflow seems to be that last event of WorkflowExecutionFailed
. So it seems that the error is returned as intended to the workflow, with some additional metdata. But what the child workflow does when it returns this error is that it actually discards the initial error, and wraps it or something. Is this intentional or am I doing something wrong here? Otherwise, how am I able to get that text/message from the error returned from the activity?