Skip to content

Commit 81e86be

Browse files
af-mdmaxdml
authored andcommitted
fix: include step name in error message when workflow state is not found in context
1 parent 3b21184 commit 81e86be

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
@@ -1271,10 +1271,10 @@ func (c *dbosContext) RunAsStep(_ DBOSContext, fn StepFunc, opts ...StepOption)
12711271
// TODO: Add docs --- will add once I get the implementation right
12721272
func Go[R any](ctx DBOSContext, fn Step[R], opts ...StepOption) (chan stepOutcome[R], error) {
12731273
// create a determistic step ID
1274-
// can we refactor this too?
1274+
stepName := runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()
12751275
wfState, ok := ctx.Value(workflowStateKey).(*workflowState)
12761276
if !ok || wfState == nil {
1277-
return nil, newStepExecutionError("", "", "workflow state not found in context: are you running this step within a workflow?")
1277+
return nil, newStepExecutionError("", stepName, "workflow state not found in context: are you running this step within a workflow?")
12781278
}
12791279
stepID := wfState.nextStepID()
12801280
opts = append(opts, WithNextStepID(stepID))

0 commit comments

Comments
 (0)