Exception handle in zend framework in module.php -
i developing zf3
app. need catch error-exception on module.php
. go through many of existing answer, seems not solve problem.
is there way catch exceptions on module.php
.
thanks
in zend framework3,
can eventmanager
, on bootstrap, in module.php
.
- event
dispatch.error
, fired on exception ondispatch
of controller, action - event
render.error
, fired on exception in rending of view(html).
public function onbootstrap(mvcevent $e) { $eventmanager = $e->getapplication()->geteventmanager(); //error on dispatch $eventmanager->attach('dispatch.error', function (mvcevent $e) { if ($e->getparam('exception')) { $exception = $e->getparam('exception'); // exception object var_dump($exception->getmessage());exit; } }, 100); // error on render $eventmanager->attach('render.error', function (mvcevent $e) { if ($e->getparam('exception')) { $exception = $e->getparam('exception'); } }, 100); }
Comments
Post a Comment