Voting

: eight plus one?
(Example: nine)

The Note You're Voting On

Anonymous
11 years ago
By default the stack trace is pretty unreadable, so you might want to wrap it in <pre> tags. Here I also wrap it in a <div> and set the class 'alert alert-danger' which are CSS classes in the Bootstrap CSS framework to style them red.
<?php

function exception_handler($exception) {
echo
'<div class="alert alert-danger">';
echo
'<b>Fatal error</b>: Uncaught exception \'' . get_class($exception) . '\' with message ';
echo
$exception->getMessage() . '<br>';
echo
'Stack trace:<pre>' . $exception->getTraceAsString() . '</pre>';
echo
'thrown in <b>' . $exception->getFile() . '</b> on line <b>' . $exception->getLine() . '</b><br>';
echo
'</div>';
}

set_exception_handler('exception_handler');

<< Back to user notes page

To Top