Skip to content

Commit 6b13309

Browse files
adenhertogclaude
andcommitted
show WorkflowMappingInvalid's help on WorkflowConfigurationFailed
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent da04c8b commit 6b13309

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/bus-core/src/workflow/configure-class-workflow.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
WorkflowAlreadyHandlesMessage,
44
WorkflowAlreadyStartedByMessage,
55
WorkflowConfigurationFailed,
6+
WorkflowMappingInvalid,
67
WorkflowStateNotProvided
78
} from './error'
89
import { Workflow, WorkflowMapper } from './workflow'
@@ -54,7 +55,11 @@ export const configureClassWorkflow = <TWorkflowState extends WorkflowState>(
5455
) {
5556
throw error
5657
}
57-
throw new WorkflowConfigurationFailed(workflowType.name, error)
58+
throw new WorkflowConfigurationFailed(
59+
workflowType.name,
60+
error,
61+
error instanceof WorkflowMappingInvalid ? error.help : undefined
62+
)
5863
}
5964

6065
const workflowStateType = mapper.workflowStateCtor

‎packages/bus-core/src/workflow/registry/workflow-registry.spec.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ describe('WorkflowRegistry', () => {
340340
expect((cause as WorkflowMappingInvalid).problem).toEqual(
341341
"a lookup whose lookup isn't a function"
342342
)
343+
expect((error as WorkflowConfigurationFailed).help).toEqual(
344+
(cause as WorkflowMappingInvalid).help
345+
)
343346
})
344347
})
345348

0 commit comments

Comments
 (0)