uber-go / cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.
https://cadenceworkflow.io
MIT License
345 stars 131 forks source link

Create cadence.IsWorkflowError helper #1145

Closed Groxx closed 2 years ago

Groxx commented 2 years ago

We have a variety of from-workflow errors that are relevant for users calling client.ExecuteWorkflow(...).Get(...) and client.GetWorkflow(...).Get(...).

Since they do not share any common wrapper or "parent type" that would allow easy comparison with an error type check or errors.As, they are rather annoying to differentiate from general RPC errors like timeouts or connection failures. Users need to check many types, and it is not generally possible for them to make that check future-proof.

So this adds a top-level "check all relevant types" helper, which is intended to be a stable target for users to rely on, even if we add more types later. It intentionally does not tell which kind of error it is, in case there are multiple types in the wrapped chain, as then behavior would be order-dependent and any change risks breaking someone's code.

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 0807aa9f-9805-4441-af24-8510c35dabac


Changes Missing Coverage Covered Lines Changed/Added Lines %
client/client.go 24 34 70.59%
<!-- Total: 24 34 70.59% -->
Totals Coverage Status
Change from base Build f63baef6-725d-44b8-8aa7-f180dc352d1a: 0.07%
Covered Lines: 12234
Relevant Lines: 19330

💛 - Coveralls