Ejemplo n.º 1
0
 public static function throwError(&$exception)
 {
     // Deprecation warning.
     MLog::add('MError::throwError() is deprecated.', MLog::WARNING, 'deprecated');
     static $thrown = false;
     // If thrown is hit again, we've come back to MError in the middle of throwing another MError, so die!
     if ($thrown) {
         self::handleEcho($exception, array());
         // Inifite loop.
         mexit();
     }
     $thrown = true;
     $level = $exception->get('level');
     // See what to do with this kind of error
     $handler = MError::getErrorHandling($level);
     $function = 'handle' . ucfirst($handler['mode']);
     if (is_callable(array('MError', $function))) {
         $reference = call_user_func_array(array('MError', $function), array(&$exception, isset($handler['options']) ? $handler['options'] : array()));
     } else {
         // This is required to prevent a very unhelpful white-screen-of-death
         mexit('MError::raise -> Static method MError::' . $function . ' does not exist.' . ' Contact a developer to debug' . '<br /><strong>Error was</strong> ' . '<br />' . $exception->getMessage());
     }
     // We don't need to store the error, since MException already does that for us!
     // Remove loop check
     $thrown = false;
     return $reference;
 }