Expanding error handling with a custom handler. All errors are converted to exceptions for easier handling and to help save time because you won't have to type out a bunch of crazy sanity checks, just try/catch FTW.
This commit is contained in:
parent
17d5738e77
commit
4307594ab5
4 changed files with 105 additions and 27 deletions
|
@ -32,25 +32,66 @@ class Error extends Object
|
|||
*/
|
||||
public static function fatal($message)
|
||||
{
|
||||
if (Log::error($message) == false)
|
||||
{
|
||||
$message .= '<br /><br />This error message could not be logged as the log path or log file is not writable';
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Error - <?=$_SERVER['SERVER_NAME'];?></title>
|
||||
<title><?php echo $_SERVER['SERVER_NAME']; ?> - error</title>
|
||||
<style>
|
||||
html{background:#eee;font-family:Verdana;width:100%}
|
||||
body{background:#ff9c9c;padding:20px;-moz-border-radius:20px;-webkit-border-radius:20px;width:550px;margin:0 auto;margin-top:100px;text-align:center;border:3px solid #890f0f}
|
||||
h1{font-size:1.5em;color:#600;text-shadow:#a86767 2px 2px 2px;margin:0}
|
||||
html
|
||||
{
|
||||
background: #eee;
|
||||
font-family: "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, sans-serif;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 1em;
|
||||
}
|
||||
body
|
||||
{
|
||||
text-align: center;
|
||||
margin-top: 100px;
|
||||
}
|
||||
div
|
||||
{
|
||||
font-size: 150%;
|
||||
color: #600;
|
||||
text-shadow: 2px 2px 2px #eb8383;
|
||||
margin: 0;
|
||||
font-weight: bold;
|
||||
background: #ff9c9c;
|
||||
padding: 20px;
|
||||
border-radius: 20px;
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 20px;
|
||||
width: 550px;
|
||||
margin: 0 auto;
|
||||
border: 3px solid #890f0f;
|
||||
}
|
||||
h1, a
|
||||
{
|
||||
font-size: 70%;
|
||||
color: #999;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover
|
||||
{
|
||||
color: #000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1><?=$message;?></h1>
|
||||
<h1><?php echo $_SERVER['SERVER_NAME']; ?></h1>
|
||||
<div><?php echo $message; ?></div>
|
||||
<a href="http://phpwithpickles.com" target="_blank">Powered by PICKLES</a>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
||||
Log::error($message);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue