Re: [DISCUSSION] User-land Throwable
| From: | Larry Garfield | Date: | Mon, 28 Jul 2025 15:27:16 +0000 |
| Subject: | Re: [DISCUSSION] User-land Throwable | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128270@lists.php.net to get a copy of this message | ||
On Mon, Jul 28, 2025, at 6:48 AM, Rokas Šleinius wrote:
> | real-world example of a use-case you want to enable
>
> Say I am implementing a job runner, I do its error handling, and I want
> to enrich the caught exception with additional helpful data for
> debugging. In this process I create a custom exception
> MyJobHandlerException, but the trace of the new exception includes my
> handler code, which the end user does not care about. I wish to
> overwrite the trace of the new MyJobHandlerException instance with the
> trace from the originally caught exception, but I cannot.
>
> I was always sure that the reason behind all methods of \Exception
> being final is Larry-Garfield-blogpost length/depth so I never bothered
> to ask and made workarounds.
Hey, I resemble that remark! :-P
(I actually have no idea what the original reason was for making so much of Exceptions final.)
I'm not sure if this would cover what you're talking about, but I did start a discussion
about lightweight exceptions a few months ago. I didn't go anywhere:
https://externals.io/message/127188
--Larry Garfield