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

Nexus error rehydration #1751

Merged
merged 4 commits into from
Dec 10, 2024
Merged

Conversation

bergundy
Copy link
Member

@bergundy bergundy commented Dec 9, 2024

What was changed

Add support for full Temporal error rehydration.
Any Temporal errors returned over the Nexus boundary will now automatically be fully rehydrated on the caller side.

Some notable points:

  • The Nexus SDK was upgraded to v0.1.0, which is a breaking change. Temporal Nexus users should refer to the release notes before upgrading the Temporal SDK.
  • nexus.HandlerError now has a Failure representation and is visible to the caller workflow.
  • Arbitrary errors are translated to ApplicationError as they do in the rest of the Temporal SDK.
  • WorkflowExecutionError, QueryRejectedError, and non retryable ApplicationErrors are no longer translated to bad request handler errors, instead they're translated to OperationErrors.

Why?

Provide a more consistent experience for Temporal users and on par debugging experience with workflows and activities.

For reviewers

I've added the tests here to illustrate the E2E behavior but I'll have to wait for a server release that supports the new behavior before merging those tests. I may commit the tests in a separate PR just to get this code in or do a server RC for the full test coverage.

@bergundy bergundy requested a review from a team as a code owner December 9, 2024 23:31
test/go.mod Outdated
@@ -67,6 +67,7 @@ require (
)

replace (
github.com/nexus-rpc/sdk-go => ../../nexus-sdk-go
Copy link
Member Author

Choose a reason for hiding this comment

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

Missed this

@bergundy bergundy force-pushed the nexus-error-rehydration branch from 186b1a6 to 8755496 Compare December 9, 2024 23:34
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

Nothing blocking, especially since Nexus is not yet GA

Comment on lines 212 to 220
if !panic {
nctx.Log.Error("Context error while processing Nexus task", "error", ctx.Err())
}
return nil, nil, errNexusTaskTimeout
}
if err != nil {
if !panic {
nctx.Log.Error("Handler returned error while processing Nexus task", "error", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if !panic {
nctx.Log.Error("Context error while processing Nexus task", "error", ctx.Err())
}
return nil, nil, errNexusTaskTimeout
}
if err != nil {
if !panic {
nctx.Log.Error("Handler returned error while processing Nexus task", "error", err)
}
if !panic {
nctx.Log.Error("Context error while processing Nexus task", tagError, ctx.Err())
}
return nil, nil, errNexusTaskTimeout
}
if err != nil {
if !panic {
nctx.Log.Error("Handler returned error while processing Nexus task", tagError, err)
}

Or is it intentionally not using that tag?

Comment on lines 212 to 214
if !panic {
nctx.Log.Error("Context error while processing Nexus task", "error", ctx.Err())
}
Copy link
Member

Choose a reason for hiding this comment

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

Arguably this should be logged regardless

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was debating but figured it'd be nicer to avoid the spam.

Comment on lines 218 to 220
if !panic {
nctx.Log.Error("Handler returned error while processing Nexus task", "error", err)
}
Copy link
Member

Choose a reason for hiding this comment

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

Arguably this log could just be after the actual call in its own if err != nil block, but not a big deal to have the bool

Copy link
Member Author

Choose a reason for hiding this comment

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

err would not be nil here, it's filled in from the panic handler.

@bergundy bergundy force-pushed the nexus-error-rehydration branch from 8755496 to 085568e Compare December 10, 2024 17:31
@bergundy bergundy merged commit d21ede2 into temporalio:master Dec 10, 2024
13 checks passed
@bergundy bergundy deleted the nexus-error-rehydration branch December 10, 2024 19:43
Failure: nexus.Failure{Message: "failed for test"},
case "failed-plain-error":
return "", nexus.NewFailedOperationError(errors.New("failed for test"))
case "failed-app-error":
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these cases for? They don't appear to be called by any test

Copy link
Member Author

Choose a reason for hiding this comment

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

I left these and didn't commit the tests since we don't have server support yet. The tests are in a branch on my machine. I can start a draft PR that we'll merge once CLI with 1.26.2 is out.

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.

3 participants