コード例 #1
0
 public function onError(EventInterface $event)
 {
     if (!isset($this->handlers[$this->current])) {
         throw new RuntimeException("{$this->current} is not supported. Add it use addHandler({$this->current}, <className>) func.");
     }
     if (!$event->getException() instanceof Exception) {
         return $event;
     }
     $whoops = new Run();
     $whoops->pushHandler($this->handlers[$this->current]);
     $whoops->pushHandler(function ($exception, $inspector, $run) use($event) {
         $run->sendHttpCode($exception->getCode());
     });
     $whoops->register();
     throw $event->getException();
 }
コード例 #2
0
ファイル: App.php プロジェクト: gianarb/penny
 /**
  * Event Manager trigger with exception
  *
  * @param EventManagerInterface $eventManager
  * @param EventInterface $event
  * @param string $name
  * @param Exception $exception
  *
  * @return EventInterface
  */
 private function triggerWithException(EventManagerInterface $eventManager, EventInterface $event, $name, Exception $exception)
 {
     $event->setName($name);
     $event->setException($exception);
     $eventManager->trigger($event);
     return $event;
 }