Ejemplo n.º 1
0
 public static function exception($exception, $trace = true)
 {
     static::log($exception);
     ob_get_level() and ob_end_clean();
     $message = $exception->getMessage();
     $file = $exception->getFile();
     if (str_contains($exception->getFile(), 'eval()') and str_contains($exception->getFile(), 'laravel' . DS . 'view.php')) {
         $message = 'Error rendering view: [' . View::$last['name'] . ']' . PHP_EOL . PHP_EOL . $message;
         $file = View::$last['path'];
     }
     if (Config::get('error.detail')) {
         $response_body = "<html><h2>Unhandled Exception</h2>\n\t\t\t\t<h3>Message:</h3>\n\t\t\t\t<pre>" . $message . "</pre>\n\t\t\t\t<h3>Location:</h3>\n\t\t\t\t<pre>" . $file . " on line " . $exception->getLine() . "</pre>";
         if ($trace) {
             $response_body .= "\n\t\t\t\t  <h3>Stack Trace:</h3>\n\t\t\t\t  <pre>" . $exception->getTraceAsString() . "</pre></html>";
         }
         $response = Response::make($response_body, 500);
     } else {
         $response = Event::first('500');
         $response = Response::prepare($response);
     }
     $response->render();
     $response->send();
     $response->foundation->finish();
     exit(1);
 }