You can see they MvcEvent which is triggered when you have an exception thrown inside the controller, there's a few other processes attaching to this event.
You could attach a method to this event and do what ever you want.
As an example look at ExceptionStrategy.php
public function prepareExceptionViewModel(MvcEvent $e)
{
....
}
If you look at the Zend Framework 2 MVC module you will see possibilities for this..
DispatchListener.php
You can see they MvcEvent which is triggered when you have an exception thrown inside the controller, there's a few other processes attaching to this event.
You could attach a method to this event and do what ever you want.
As an example look at ExceptionStrategy.php
The easiest way is to use config
config/autoload/local.php
Adding this lines disables exceptions. In addition you can use your own
local.php
on a dev server.Final Solution in my Module.php
it works and only loads error/404 view file not the layout file
thanks andrew
this is not your ans but it will help to other in zf2