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

Add MultiOperation errors #158

Merged
merged 8 commits into from
Apr 24, 2024
Merged

Conversation

stephanos
Copy link
Contributor

@stephanos stephanos commented Apr 17, 2024

What changed?

Added two new error types, both for MultiOperationExecution.

The errors behavior was documented in temporalio/api#367.

Why?

To return these errors from the Server (see PR).

How did you test it?

Add new tests and Server implementation PR.

Potential risks

None

serviceerror/convert_test.go Outdated Show resolved Hide resolved
serviceerror/multiOpAborted.go Outdated Show resolved Hide resolved
serviceerror/multiOpAborted.go Outdated Show resolved Hide resolved
@stephanos stephanos force-pushed the multiops-errors branch 3 times, most recently from adde912 to 74f3253 Compare April 19, 2024 22:51
@@ -71,7 +72,21 @@ func FromStatus(st *status.Status) error {
return nil
}

// Simple case. `st.Code()` to `serviceerror` is one to one mapping and there are no error details.
errDetails := extractErrorDetails(st)
Copy link
Contributor Author

@stephanos stephanos Apr 19, 2024

Choose a reason for hiding this comment

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

The error parsing had to be changed so that it always parses the error details first. This adds an extra step for status codes such as Unavailable and Canceled, but is most likely negligible.

case *failure.MultiOperationExecutionAborted:
return newMultiOperationAborted(st)
default:
return st.Err()
Copy link
Member

Choose a reason for hiding this comment

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

I would do same as on line 190, or add generic AbortedError with empty details.

Copy link
Member

Choose a reason for hiding this comment

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

multi_op_aborted.go please. And someone need to rename all other files in this package.

}

// NewMultiOperationAbortedError returns MultiOperationAborted.
func NewMultiOperationAbortedError(message string) error {
Copy link
Member

Choose a reason for hiding this comment

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

You need to be consistent in using Error suffix. I agree on not using Failure suffix for proto message and I would prefer to use Error suffix for error because it is essentially a error in go world. Or remove Error() method.

Makefile Outdated
@@ -41,7 +41,7 @@ $(PROTO_OUT):
##### git submodule for proto files #####
update-proto-submodule:
printf $(COLOR) "Update proto-submodule..."
git -c protocol.file.allow=always submodule update --init --force --remote $(PROTO_ROOT)
#git -c protocol.file.allow=always submodule update --init --force --remote $(PROTO_ROOT)
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to uncomment this.

@stephanos stephanos merged commit ea7944a into temporalio:master Apr 24, 2024
3 checks passed
@stephanos stephanos deleted the multiops-errors branch April 24, 2024 22:46
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.

I was intentionally waiting on API repo merge before giving approval here, but it looks like it was merged w/ no SDK approval because our branch protections and codeowners don't require it. I wonder if we should change this repo to be like the api repo w/ the restrictions there.

@stephanos
Copy link
Contributor Author

stephanos commented Apr 25, 2024

@cretz
Sorry, I should have pinged you (or someone else from SDK) again. If there are any concerns with this PR in particular, please let me know. I can still make amendments.

I agree, it's probably a good idea to require SDK approval here. I looked over the recent PRs and most - but not all - had SDK approval (but most didn't have Server approval).

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