Created
September 19, 2016 19:54
-
-
Save ppeiris/9eaef64428540c5c1ae2f4eb324c5dae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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