Skip to content

Commit 956ec68

Browse files
committed
fix: include step name in error message when workflow state is not found in context
1 parent c8a0ca7 commit 956ec68

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dbos/workflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,10 +1222,10 @@ func (c *dbosContext) RunAsStep(_ DBOSContext, fn StepFunc, opts ...StepOption)
12221222
// TODO: Add docs --- will add once I get the implementation right
12231223
func Go[R any](ctx DBOSContext, fn Step[R], opts ...StepOption) (chan stepOutcome[R], error) {
12241224
// create a determistic step ID
1225-
// can we refactor this too?
1225+
stepName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
12261226
wfState, ok := ctx.Value(workflowStateKey).(*workflowState)
12271227
if !ok || wfState == nil {
1228-
return nil, newStepExecutionError("", "", "workflow state not found in context: are you running this step within a workflow?")
1228+
return nil, newStepExecutionError("", stepName, "workflow state not found in context: are you running this step within a workflow?")
12291229
}
12301230
stepID := wfState.nextStepID()
12311231
opts = append(opts, WithNextStepID(stepID))

0 commit comments

Comments
 (0)