2017-07-14 19 views

答えて

0
public function onBootstrap(MvcEvent $e) 
{ 
    $application = $e->getApplication(); 
    $em = $application->getEventManager(); 
    //handle the dispatch error (exception) 
    $em->attach(\Zend\Mvc\MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'handleError')); 
    //handle the view render error (exception) 
    $em->attach(\Zend\Mvc\MvcEvent::EVENT_RENDER_ERROR, array($this, 'handleError')); 
} 

public function handleError(MvcEvent $e) 
{ 
     if($e->getError() == 'error-exception'){ 
     $exception = $e->getParam('exception'); 
     $bugsnag = Bugsnag\Client::make("MYKEY"); 
     Bugsnag\Handler::register($bugsnag); 
     $bugsnag->notifyException($exception); 

    } 
} 
関連する問題