Beispiel #1
0
 /**
  * Handle an uncaught exception
  *
  * @param object $exception
  */
 public function onException($exception)
 {
     $that = $this;
     $cwd = $this->cwd;
     $debug = $this->debug;
     $e = null;
     try {
         // fix working directory
         if (null !== $cwd) {
             chdir($cwd);
         }
         // handle the exception
         $fatalHandler = $that->getFatalHandler();
         $e2 = null;
         try {
             $this->emitArray('fatal', array($exception, $debug, &$fatalHandler));
         } catch (\Exception $e2) {
         } catch (\Throwable $e2) {
         }
         if (null !== $e2) {
             $exception = Debug::joinExceptionChains($exception, $e2);
         }
         if (null !== $fatalHandler) {
             $that->handleFatal($fatalHandler, $exception);
         }
     } catch (\Exception $e) {
     } catch (\Throwable $e) {
     }
     if (null !== $e) {
         $exception = Debug::joinExceptionChains($exception, $e);
         if ($this->hasListeners('emerg')) {
             $this->emit('emerg', $exception, $this->debug);
         } elseif ($debug) {
             // debug mode is on and there is no emergency listener
             // just print the exception in this case (prevents white screen)
             echo $exception;
         }
     }
 }