tl:dr
Is is possible to set the previous exception without being through the constructor?
We're using a base exception which already multiple arguments, I don't intend to add more (if possible). So what I though is to add a method withPrevious(\Exception $e)
to the base exception. So it could be used like:
catch(SomeException $e) {
throw new SpecificException($arg1, $arg2)->withPrevious($e);
}
However I couldn't find any kind of setter for the previous exception, I really think it must be set by the __construct()
Any idea if is it possible?
Thanks