temporalio / temporalio/sdk-php

[Feature Request] FailureConverter allow more context in ordinary exceptions

Open
#244 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
421
Forks
64
Avg merge
1d 1h
Merged PRs (30d)
11

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading FailureConverter, especially mapFailureToException, along with ApplicationFailure and the existing UserExceptions and ApplicationExceptions interfaces described in the issue. Determine how ordinary exceptions could expose getDetails() without extending ApplicationFailure. Done means the conversion preserves the relevant context and parameters for these exceptions, with coverage for the affected conversion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.