In zend 2, how can I create an internal server error whenever an exception occurs regardless of the controller that is related to that exception?
With internal server error I only mean setting the status code to 500!
In zend 2, how can I create an internal server error whenever an exception occurs regardless of the controller that is related to that exception?
With internal server error I only mean setting the status code to 500!
In your onBootstrap() of your Module.php attach an Event to listen for dispatch error.
$eventManager = $e->getApplication()->getEventManager();
$eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, function($event){
$response = $event->getResponse();
$response->setStatusCode(500);
return $response;
});