feat(workflows-sdk): log on error (#8666)
This commit is contained in:
committed by
GitHub
parent
1be9373290
commit
eb0bfe9f33
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
DistributedTransaction,
|
||||
DistributedTransactionType,
|
||||
DistributedTransactionEvents,
|
||||
DistributedTransactionType,
|
||||
TransactionHandlerType,
|
||||
TransactionStep,
|
||||
WorkflowScheduler,
|
||||
@@ -109,6 +109,7 @@ export class WorkflowOrchestratorService {
|
||||
transactionId,
|
||||
resultFrom,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
events: eventHandlers,
|
||||
container,
|
||||
} = options ?? {}
|
||||
@@ -148,6 +149,7 @@ export class WorkflowOrchestratorService {
|
||||
const ret = await flow.run({
|
||||
input,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
resultFrom,
|
||||
context,
|
||||
events,
|
||||
@@ -223,6 +225,7 @@ export class WorkflowOrchestratorService {
|
||||
const {
|
||||
context,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
resultFrom,
|
||||
container,
|
||||
events: eventHandlers,
|
||||
@@ -251,6 +254,7 @@ export class WorkflowOrchestratorService {
|
||||
context,
|
||||
resultFrom,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
events,
|
||||
response: stepResponse,
|
||||
})
|
||||
@@ -285,6 +289,7 @@ export class WorkflowOrchestratorService {
|
||||
const {
|
||||
context,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
resultFrom,
|
||||
container,
|
||||
events: eventHandlers,
|
||||
@@ -313,6 +318,7 @@ export class WorkflowOrchestratorService {
|
||||
context,
|
||||
resultFrom,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
events,
|
||||
response: stepResponse,
|
||||
})
|
||||
|
||||
@@ -11,20 +11,20 @@ import {
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
createMedusaContainer,
|
||||
Module,
|
||||
Modules,
|
||||
TransactionHandlerType,
|
||||
TransactionStepState,
|
||||
createMedusaContainer,
|
||||
} from "@medusajs/utils"
|
||||
import { WorkflowsModuleService } from "@medusajs/workflow-engine-inmemory/dist/services"
|
||||
import { asFunction, asValue } from "awilix"
|
||||
import Redis from "ioredis"
|
||||
import { knex } from "knex"
|
||||
import { setTimeout } from "timers/promises"
|
||||
import "../__fixtures__"
|
||||
import { createScheduled } from "../__fixtures__/workflow_scheduled"
|
||||
import { DB_URL, TestDatabase } from "../utils"
|
||||
import { WorkflowsModuleService } from "@medusajs/workflow-engine-inmemory/dist/services"
|
||||
import Redis from "ioredis"
|
||||
|
||||
jest.setTimeout(100000)
|
||||
|
||||
@@ -216,6 +216,7 @@ describe("Workflow Orchestrator module", function () {
|
||||
myInput: "123",
|
||||
},
|
||||
throwOnError: false,
|
||||
logOnError: true,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
DistributedTransaction,
|
||||
DistributedTransactionType,
|
||||
DistributedTransactionEvents,
|
||||
DistributedTransactionType,
|
||||
TransactionHandlerType,
|
||||
TransactionStep,
|
||||
WorkflowScheduler,
|
||||
@@ -12,12 +12,12 @@ import {
|
||||
Logger,
|
||||
MedusaContainer,
|
||||
} from "@medusajs/types"
|
||||
import { InjectSharedContext, isString, MedusaContext } from "@medusajs/utils"
|
||||
import { InjectSharedContext, MedusaContext, isString } from "@medusajs/utils"
|
||||
import {
|
||||
FlowRunOptions,
|
||||
MedusaWorkflow,
|
||||
resolveValue,
|
||||
ReturnWorkflow,
|
||||
resolveValue,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
import Redis from "ioredis"
|
||||
import { ulid } from "ulid"
|
||||
@@ -158,6 +158,7 @@ export class WorkflowOrchestratorService {
|
||||
transactionId,
|
||||
resultFrom,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
events: eventHandlers,
|
||||
container,
|
||||
} = options ?? {}
|
||||
@@ -191,6 +192,7 @@ export class WorkflowOrchestratorService {
|
||||
const ret = await flow.run({
|
||||
input,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
resultFrom,
|
||||
context,
|
||||
events,
|
||||
@@ -266,6 +268,7 @@ export class WorkflowOrchestratorService {
|
||||
const {
|
||||
context,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
resultFrom,
|
||||
container,
|
||||
events: eventHandlers,
|
||||
@@ -294,6 +297,7 @@ export class WorkflowOrchestratorService {
|
||||
context,
|
||||
resultFrom,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
events,
|
||||
response: stepResponse,
|
||||
})
|
||||
@@ -328,6 +332,7 @@ export class WorkflowOrchestratorService {
|
||||
const {
|
||||
context,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
resultFrom,
|
||||
container,
|
||||
events: eventHandlers,
|
||||
@@ -356,6 +361,7 @@ export class WorkflowOrchestratorService {
|
||||
context,
|
||||
resultFrom,
|
||||
throwOnError,
|
||||
logOnError,
|
||||
events,
|
||||
response: stepResponse,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user