1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php namespace Laravel;
- class Error {
-
- public static function exception($exception)
- {
- static::log($exception);
-
-
-
-
- if (Config::get('error.detail'))
- {
- echo "<html><h2>Unhandled Exception</h2>
- <h3>Message:</h3>
- <pre>".$exception->getMessage()."</pre>
- <h3>Location:</h3>
- <pre>".$exception->getFile()." on line ".$exception->getLine()."</pre>
- <h3>Stack Trace:</h3>
- <pre>".$exception->getTraceAsString()."</pre></html>";
- }
- else
- {
- Response::error('500')->send();
- }
- exit(1);
- }
-
- public static function native($code, $error, $file, $line)
- {
- if (error_reporting() === 0) return;
-
-
-
-
- $exception = new \ErrorException($error, $code, 0, $file, $line);
- if (in_array($code, Config::get('error.ignore')))
- {
- return static::log($exception);
- return true;
- }
- static::exception($exception);
- }
-
- public static function shutdown()
- {
-
-
-
- if ( ! is_null($error = error_get_last()))
- {
- extract($error, EXTR_SKIP);
- static::exception(new \ErrorException($message, $type, 0, $file, $line));
- }
- }
-
- public static function log($exception)
- {
- if (Config::get('error.log'))
- {
- call_user_func(Config::get('error.logger'), $exception);
- }
- }
- }
|