コード例 #1
0
 /**
  * @param ExceptionEvent $event
  */
 public function onException(ExceptionEvent $event)
 {
     $exception = $event->getException();
     $content = new Json();
     $content->setJson(['file' => str_replace(APP_ROOT_PATH, '', $exception->getFile()), 'line' => $exception->getLine(), 'message' => $exception->getMessage()]);
     $this->getResponse()->setStatusCode(500)->setContent($content);
 }
コード例 #2
0
ファイル: Application.php プロジェクト: nfavaron/arrow
 /**
  * Runs the application
  *
  * @return $this
  */
 public function run()
 {
     try {
         // Dispatch the request using the router
         $this->getRouter()->dispatch($this->getRequest());
     } catch (Exception $exception) {
         // Create event
         $event = new ExceptionEvent();
         $event->setName(ExceptionEvent::EXCEPTION)->setException($exception);
         // Trigger event
         $this->getEventManager()->trigger($event);
     }
     // Send response
     $this->getResponse()->sendHeaders()->sendContent();
     return $this;
 }