public static function exceptionHandler(\Exception $e) { $fullTrace = $e->getTrace(); if (is_callable(array($e, 'postAction'))) { $e->postAction($e->getMessage(), $e->getCode()); } if (!DC::getProjectConfig('devMode')) { DC::getLogger()->add('Exception: ' . $e->getMessage(), 'exception'); die; } $content = '<div style="font-size: 13px; font-family: Consolas, Menlo, Monaco, monospace;white-space: pre-wrap;">'; $htmlTrace = "<b>\nLast arguments(" . count($fullTrace[0]['args']) . "):</b>\n" . dumpAsString($fullTrace[0]['args']) . "<b>\n\nCall stack:</b>\n<table style='font-size: 13px;'>"; foreach ($fullTrace as $item) { $info = self::compileShortCallee($item); $htmlTrace .= '<tr><td style="color:#666;padding-right:10px;">' . $info['file'] . '</td><td>' . $info['call'] . '</td></tr>'; } $htmlTrace .= '</table>'; $content .= '<div style="background:#c00;color:white;font-weight:bold;padding:5px;margin-bottom: 5px; ">' . $e->getMessage() . '</div>'; $content .= $htmlTrace; $content .= '</div>'; if (DC::getRouter()->getExecutionMode() == Request::MODE_CONSOLE) { $content = strip_tags(str_replace('</td><td>', "\n", $content)) . "\n"; } echo $content; die; }