chore(workflows-sdk): Display each error individually instead of packed (#10072)

**What**
Instead of displaying a single string prepared with all the errors, log each error individually
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2024-11-15 11:27:52 +00:00
1 parent dea86d8c87
commit 10da8b379f
1 file changed
+4 -11
@@ -519,21 +519,14 @@ function attachOnFinishReleaseEvents(
) || console ) || console
if (logOnError) { if (logOnError) {
const TERMINAL_SIZE = process.stdout?.columns ?? 60
const separator = new Array(TERMINAL_SIZE).join("-")
const workflowName = transaction.getFlow().modelId const workflowName = transaction.getFlow().modelId
const allWorkflowErrors = transaction transaction
.getErrors() .getErrors()
.map( .forEach((err) =>
(err) => logger.error(
`${workflowName}:${err?.action}:${err?.handlerType} - ${err?.error?.message}${EOL}${err?.error?.stack}` `${workflowName}:${err?.action}:${err?.handlerType} - ${err?.error?.message}${EOL}${err?.error?.stack}`
)
) )
.join(EOL + separator + EOL)
if (allWorkflowErrors) {
logger.error(allWorkflowErrors)
}
} }
await onFinish?.(args) await onFinish?.(args)