Hi

On 10/18/22 09:32, Derick Rethans wrote:
If I'm reading the implementation correctly, the original exception
is thrown away, there's no way to get the
original message and backtrace.
That will make debugging more difficult.

I believe that is not true. It should be wrapped and accessible through 
->previous on the exception.


Correct, the original Exception/Error will be available using $e->getPrevious(). This is also explained in the RFC in the "Add wrapper Exception 'UnserializationFailedException'" section:

The original \Throwable will be accessible through the $previous property of \UnserializationFailedException, allowing the developer to learn about the actual cause of the unserialization failure by inspecting ->getPrevious().

This is not apparent from taking a cursory look at the diff of the native implementation in the pull request, because setting $previous will happen implicitly whenever native code throws an Exception, while an Exception is already "active".

Best regards
Tim Düsterhus

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to