Skip to content

Instantly share code, notes, and snippets.

@ppeiris
Created September 19, 2016 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppeiris/9eaef64428540c5c1ae2f4eb324c5dae to your computer and use it in GitHub Desktop.
Save ppeiris/9eaef64428540c5c1ae2f4eb324c5dae to your computer and use it in GitHub Desktop.
public function attach(EventManagerInterface $events)
{
$events->attach('dispatch.error', array($this, 'onDispatchError'), 100);
}
public function onDispatchError($e)
{
// $logInfo = [
// 'event' => $e->getRequest()->getServer()->toArray(),
// 'error' => $e->getError()
// ];
// print_r($logInfo);
$newRouteMatch = new RouteMatch(
['controller' => $e->getApplication()
->getServiceManager()
->get('config')
['router']
['routes']
['error.rest.error']
['options']
['defaults']
['controller'] // get the default error controller
]
);
$e->setRouteMatch($newRouteMatch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment