Ejemplo n.º 1
0
/**
 * Custom exception handler
 * 
 * @param  [type] $e [description]
 * @return [type]    [description]
 */
function exception_handler($e)
{
    echo "\n<style>\n\t.dmnErr{\n\t\tpadding : 100px;\n\t\tfont-family : Helvetica, Arial, sans-serif;\n\t\tline-height : 1.8em;\n\t\tcolor: #333;\n\t}\n\t.damnMsg{\n\t\tfont-size: 2em;\n\t\tline-height: 2.2em;\n\t\tfont-weight : bold;\n\n\t}\n</style>\n\t";
    echo '<div class="dmnErr">';
    echo '<div class="damnMsg">' . $e->getMessage() . "</div>";
    echo '<div class="damnFl">File : ' . $e->getFile() . "</div>";
    echo '<div class="damnLn"> Line : ' . $e->getLine() . "</div>";
    echo '<pre class="damnTrc">';
    echo "<h2>Trace:</h2>" . $e->getTraceAsString() . "<br>";
    echo "</pre>";
    echo '</div>';
}
 /**
  * [placeholder description]
  *
  * @param [type] $exception [placeholder]
  * @return [type]
  */
 public static function formatException($exception)
 {
     if ($exception instanceof MOJOInstallFailedException) {
         $situation = $exception->getSituation();
     } elseif (self::$step) {
         $situation = self::$step;
     } else {
         $situation = $exception->getFile() . ':' . $exception->getLine();
     }
     if ($exception instanceof MOJOContinueException) {
         return array('status' => 'continue', 'continue' => true, 'situation' => $situation, 'logs' => self::$logs, 'softFailures' => self::$softFailures);
     }
     return array('status' => 'exception', 'version' => phpversion(), 'situation' => $situation, 'step' => self::$step ? self::$step : 'other', 'message' => $exception->getMessage(), 'class' => get_class($exception), 'trace' => $exception->getTraceAsString(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'server' => $_SERVER, 'post' => $_POST, 'get' => $_GET, 'softFailures' => self::$softFailures, 'logs' => self::$logs, 'ini' => ini_get_all(), 'extensions' => get_loaded_extensions());
 }