Skip to content

Commit e156816

Browse files
committed
fix
1 parent 7935dfb commit e156816

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
@@ -744,7 +744,7 @@ func RunAsStep[P any, R any](ctx DBOSContext, fn GenericStepFunc[R]) (R, error)
744744
typeErasedFn := StepFunc(func(ctx context.Context) (any, error) { return fn(ctx) })
745745
typeErasedStepNameToStepName[runtime.FuncForPC(reflect.ValueOf(typeErasedFn).Pointer()).Name()] = stepName
746746

747-
// Call the executor method
747+
// Call the executor method and pass through the result/error
748748
result, err := ctx.RunAsStep(ctx, typeErasedFn)
749749
// Step function could return a nil result
750750
if result == nil {
@@ -755,7 +755,7 @@ func RunAsStep[P any, R any](ctx DBOSContext, fn GenericStepFunc[R]) (R, error)
755755
if !ok {
756756
return *new(R), fmt.Errorf("unexpected result type: expected %T, got %T", *new(R), result)
757757
}
758-
return typedResult, nil
758+
return typedResult, err
759759
}
760760

761761
func (c *dbosContext) RunAsStep(_ DBOSContext, fn StepFunc) (any, error) {

0 commit comments

Comments
 (0)