sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

[Feature Request] FailureConverter allow more context in ordinary exceptions

Open zajca opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

We have older codebase where we have interfaces called UserExceptions and ApplicationExceptions based on this interfaces we know if error should be shown to user or not. Interfaces has also methods like getContext:array and getParameters:array which are similar to temporal failure details. When temporal activity fails we are not throwing temporal failures since our app is bit old and has hundreds of such exceptions.

What SDK does is to call mapFailureToException and our context is lost here since it really just handles instance of temporal failures.

Describe the solution you'd like

Would be great if ApplicationFailure was an interface this way we can just force our exceptions to implement this and create details and don't have to extend ApplicationFailure all the way.

Event something like:

interface FailureWithDetails
  public function getDetails(): ValuesInterface

would probably solve the problem.

zajca avatar Sep 14 '22 06:09 zajca

Or maybe interface like:

interface HasFailureInfo
  public function getFailureInfo(): ApplicationFailureInfo

zajca avatar Sep 14 '22 06:09 zajca