try {
$application = new \Phalcon\Mvc\Application($di);
....
echo $application->handle()->getContent();
} catch (\Exception $e) {
$traza=str_replace("\n",'<br>',$e->getTraceAsString());
$application->dispatcher->forward([
'controller'=>'error',
'action'=>'error500',
'params'=>[$e->getMessage(),$traza]
]);
}
I wrote this code snippet to catch global exceptions and redirect them to error::error500(), but not works. What I'm doing bad?
Thanks!!