Example #1
0
 /**
  * Handle an exception and display the exception report.
  *
  * @param \Exception $exception
  * @param Logger     $logger
  * @param boolean    $exit
  */
 public static function exception(\Exception $exception, Logger $logger, $exit = true)
 {
     static::log($exception, $logger);
     ob_get_length() > 0 && ob_get_level() && ob_end_clean();
     if (Config::get('error.debug_info') === true) {
         echo static::format($exception, Sapi::isCli());
         if ($exit) {
             exit;
         }
     }
     if ($exception instanceof \Pimf\Controller\Exception || $exception instanceof \Pimf\Resolver\Exception) {
         Event::first('404', array($exception));
         Header::sendNotFound(null, $exit);
     } else {
         Event::first('500', array($exception));
         Header::sendInternalServerError(null, $exit);
     }
 }
 /**
  * Handle an exception and display the exception report.
  *
  * @param \Exception $exception
  * @param boolean    $exit
  */
 public static function exception(\Exception $exception, $exit = true)
 {
     static::log($exception);
     ob_get_length() > 0 and ob_get_level() and ob_end_clean();
     $conf = Registry::get('conf');
     if (isset($conf['error']['debug_info']) && $conf['error']['debug_info'] === true) {
         echo static::format($exception);
         if ($exit) {
             exit;
         }
     }
     Header::clear();
     if ($exception instanceof \Pimf\Controller\Exception || $exception instanceof \Pimf\Resolver\Exception) {
         Event::first('404', array($exception));
         Header::sendNotFound(null, $exit);
     } else {
         Event::first('500', array($exception));
         Header::sendInternalServerError(null, $exit);
     }
 }