Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak Update-with-Start error reporting #1746

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

stephanos
Copy link
Contributor

@stephanos stephanos commented Dec 6, 2024

What was changed

Tweak error reporting of Update-with-Start.

Why?

Communicate errors better to user.

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

@stephanos stephanos requested a review from a team as a code owner December 6, 2024 22:42
@@ -1800,7 +1800,7 @@ func (w *workflowClientInterceptor) UpdateWithStartWorkflow(
}
handle, err := w.updateHandleFromResponse(ctx, updateReq.WaitPolicy.LifecycleStage, updateResp)
if err != nil {
return nil, fmt.Errorf("%w: %w", errInvalidWithStartWorkflowOperation, err)
return nil, err
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping with errInvalidWithStartWorkflowOperation ("invalid WithStartWorkflowOperation") is inappropriate IMO, since it's not related to the start operation.

return nil, startErr

// this should never happen
return nil, errors.New(multiErr.Error())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would only happen if the server sent back [nil, nil]; which would be a bug. But in case it does, this is the fallback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be honest and return a message like "This should never happen, please report a bug at ..."?

Copy link
Contributor Author

@stephanos stephanos Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I only saw this comment now. I'm not sure; is that something we do?

This scenario would mean the server decided to create a MultiOps error, but messed up the inner errors. So the server's intention is unambiguous; but there aren't enough details sent back to the user. Would it be reasonable to assume that a user will be confused and ask for better errors?

@@ -1167,32 +1217,6 @@ func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_ServerResponseCountMism
s.ErrorContains(err, "invalid server response: 0 instead of 2 operation results")
}

func (s *workflowRunSuite) TestExecuteWorkflowWithUpdate_ServerErrorResponseCountMismatch() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved into the above.

}
case *workflowservice.ExecuteMultiOperationRequest_Operation_UpdateWorkflow:
if !errors.As(opErr, &abortedErr) {
startErr = fmt.Errorf("%w: %w", errInvalidWithStartWorkflowOperation, opErr)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"invalid WithStartWorkflowOperation" isn't quite accurate anyway. It could have just "failed" despite the operation itself being valid.

Copy link
Contributor

@dandavison dandavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@stephanos stephanos merged commit 41e9b33 into temporalio:master Dec 9, 2024
13 checks passed
@stephanos stephanos deleted the uws-errors branch December 9, 2024 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants