exception tracking and blocking it in zend framework 2 -
exception tracking and blocking it in zend framework 2 -
how stop exception showing in zend framework 2 , instead when exception thrown want redirect 404 page . when user fires wrong url or how query gets executed in wrong way exception thrown , need block exception , instead redirect other designed page . i'm unable track the exception point or rather grab exception or exception generated . have used code can handle exceptions in anyway want after catching next illustration in catching exception globally...:
in onbootstrap method have attached next code in module.php in function execute when event occurs, next attach function executed when error (exception) raised:
public function onbootstrap(mvcevent $e) { $application = $e->getapplication(); $em = $application->geteventmanager(); //handle dispatch error (exception) $em->attach(\zend\mvc\mvcevent::event_dispatch_error, array($this, 'handleerror')); //handle view render error (exception) $em->attach(\zend\mvc\mvcevent::event_render_error, array($this, 'handleerror')); } , defineed in module.php function handle error public function handleerror(mvcevent $e) { //get exception $exception = $e->getparam('exception'); //...handle exception... maybe log , redirect page, //or send email exception occurred... }
i found code stackoverflow , not working , mean when i'm passing wrong parameters in url , showing " 404 error occurred page not found.
the requested controller unable dispatch request.
controller: front\controller\front
no exception available "
please need help on this.
you can turn off exceptions in zf2 chaining 'display_exceptions' => true 'display_exceptions' => false, [module/application/config/module.config.php]
exception zend-framework2
Comments
Post a Comment