fix: errors thrown in transformer (#7480)

* chore: wup

* throw on error

* add back test

---------

Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com>
This commit is contained in:
Oli Juhl
2024-05-28 08:44:33 +02:00
committed by GitHub
co-authored by Carlos R. L. Rodrigues
parent 2f20dbd50d
commit ad21bd30b1
3 changed files with 10 additions and 7 deletions
@@ -5,7 +5,7 @@ import {
TransactionState,
} from "@medusajs/orchestration"
import { LoadedModule, MedusaContainer } from "@medusajs/types"
import { isPresent, MedusaContextType } from "@medusajs/utils"
import { MedusaContextType, isPresent } from "@medusajs/utils"
import { EOL } from "os"
import { ulid } from "ulid"
import { MedusaWorkflow } from "../medusa-workflow"
@@ -99,6 +99,10 @@ function createContextualWorkflowRunner<
result = resolveValue(resultFrom, transaction.getContext())
if (result instanceof Promise) {
result = await result.catch((e) => {
if (throwOnError) {
throw e
}
errors ??= []
errors.push(e)
})