fix(workflows-sdk): Handle result from a trasnformer after a step fail (#6951)

* fix(workflows-sdk): Handle result from a trasnformer after a step fail

* Create plenty-ravens-lay.md

* fix
This commit is contained in:
Adrien de Peretti
2024-04-05 08:59:28 +02:00
committed by GitHub
parent 849010d875
commit 71aeda7347
4 changed files with 55 additions and 3 deletions
@@ -192,7 +192,7 @@ function createContextualWorkflowRunner<
) => {
const transaction = await method.apply(method, args)
const errors = transaction.getErrors(TransactionHandlerType.INVOKE)
let errors = transaction.getErrors(TransactionHandlerType.INVOKE)
const failedStatus = [TransactionState.FAILED, TransactionState.REVERTED]
const isCancelled =
@@ -211,7 +211,13 @@ function createContextualWorkflowRunner<
let result
if (options?.wrappedInput) {
result = await resolveValue(resultFrom, transaction.getContext())
result = resolveValue(resultFrom, transaction.getContext())
if (result instanceof Promise) {
result = await result.catch((e) => {
errors ??= []
errors.push(e)
})
}
} else {
result = transaction.getContext().invoke?.[resultFrom]
}