Skip to content

workflow.Cause(ctx) is not exposed #470

Description

@raymondsze

As title, the Cause(ctx) is in the internal package.

func Workflow(ctx workflow.Context, input string) (string, error) {
	ctx, cancel := workflow.WithCancelCause(ctx)
        cancel(errors.New("This workflow is canceled"))
        return "", ctx.Err()
}

This will get context cancelled error in client.GetWorkflowResult

To get the underling error correctly... it should be

func Workflow(ctx workflow.Context, input string) (string, error) {
	ctx, cancel := workflow.WithCancelCause(ctx)
        cancel(errors.New("This workflow is canceled"))
        return "", workflow.Cause(ctx.Err())
}

But workflow.Cause is not exposed in this library, so not possible to get the underlying error.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions