-
Notifications
You must be signed in to change notification settings - Fork 118
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
Update-with-start #1585
Update-with-start #1585
Conversation
8af1806
to
1f4ad3e
Compare
packages/common/src/errors.ts
Outdated
* Thrown when it's necessary to rethrow a grpc-js ServiceError with modifications. | ||
*/ | ||
@SymbolBasedInstanceOfError('CustomGrpcServiceError') | ||
export class CustomGrpcServiceError extends Error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put that error in client/src/errors.ts
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, not a fan of the name. "custom" in this context means nothing to the end user. Could we have more targetted errors? Or merge this one with client.ServiceError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted all changes to common/src
. Still not sure how to rethrow GrpcServiceError
. One option seems to be just to mutate the received error and re-throw it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am:
- Identifying
WorkflowExecutionAlreadyStartedError
and using that as the error if appropriate - Otherwise mutating the received error so that it acquires the more specific GrpcServiceError fields (code, message) as unpacked from the MultiOp error, and rethrowing the altered GrpcServiceError error
packages/client/src/helpers.ts
Outdated
if (statusType === 'temporal.api.failure.v1.MultiOperationExecutionAborted') { | ||
continue; | ||
} | ||
throw new CustomGrpcServiceError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of details do we have here? Could we map these statuses to error classes that we already have elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above #1585 (comment)
Please make sure to add |
|
||
constructor( | ||
public workflowTypeOrFunc: string | T, | ||
public options: WorkflowStartOptions<T> & { workflowIdConflictPolicy: WorkflowIdConflictPolicy } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can live with this temporarily, but we should avoid ad-hoc types in public facing APIs.
7f7ed9e
to
f098dce
Compare
This is ready for another pass @mjameswh |
One uncertainty I have is exactly how we should construct the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Thanks very much for the expert reviewing @mjameswh, as always. |
Co-authored-by: James Watkins-Harvey <james.watkinsharvey@temporal.io> (cherry picked from commit dfb524e)
This PR adds an API for "update-with-start", using the MultiOperation gRPC API.
The test suite is incomplete, but please feel free to review the API, implementation, and tests that are present.
The following code demonstrates the API and is taken from the early-return sample:
Public API
startUpdateWithStart
with interfacesWorkflowStartUpdateWithStartInput
andWorkflowStartUpdateWithStartOutput
WithStartWorkflowOperation
WorkflowClient.executeUpdateWithStart
andWorkflowClient.startUpdateWithStart