So I catch an exception (instance of Exception class) and what I want to do is change its exception message.
I can get the exception message like this:
$e->getMessage();
But how to set an exception message? This won’t work:
$e->setMessage('hello');
You can’t change Exception message.
You can however determine it’s class name and code, and throw a new one, of the same class, with same code, but with different message.