2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework
5 || # Copyright (c)2005-2008 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Exception Handler (ExceptionHandler.php)
31 * This class will handle all exceptions that are uncaught in an application
34 * @copyright Copyright (c)2005 - 2008, Blue Static
38 class BSExceptionHandler
40 private function __construct()
44 * This is the handling dispatcher function that will examine, process
45 * and properly display exceptions
47 public static function handle(Exception
$e)
49 // see if this was an application-level or framework-level exception
50 $trace = $e->getTrace();
52 foreach ($trace as $i => $frame)
54 if (!isset($frame['file']))
58 if (strpos($frame['file'], ISSO
) !== false || substr($frame['class'], 0, 2) == 'BS')
65 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN"
66 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
67 <html xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="en">
69 <title
>Uncaught Exception
</title
>
71 <style type
="text/css">
75 font
-family
: Helvetica
, Arial
, Verdana
, sans
-serif
;
80 background
-image
: url('data:image/png;base64,<?php echo self::get_alert_image() ?>');
81 background
-repeat
: no
-repeat
;
83 margin
: 75px
0px
0px
150px
;
91 color
: rgb(175, 0, 0);
105 <h1
>Uncaught Exception
</h1
>
108 <em
>An exception was encountered during the exection of this program
. Because the program could not recover
109 from this error it terminated prematurely
. Please contact a system administrator
if this problem persists
.</em
>
114 <p
><strong
>Time
:</strong
> <?php
echo date('r') ?></p
>
116 <p
><strong
>Context
:</strong
> <?php
echo ($framework ? 'Framework' : 'Application')?></p
>
118 <p
><strong
>Class:</strong
> <?php
echo get_class($e) . (get_parent_class($e) ? ' < ' . get_parent_class($e) : '') ?></p
>
120 <p
><strong
>Message
:</strong
> <?php
echo $e->getMessage() ?></p
>
123 <strong
>Stack Trace
:</strong
><br
/>
126 $trace = $e->getTraceAsString();
127 echo (BSApp
::get_debug() ? $trace : str_replace(getcwd(), '', $trace));
139 * Returns a base-64 representation of an alert sign
143 protected static function get_alert_image()
145 return 'iVBORw0KGgoAAAANSUhEUgAAADcAAAA3CAYAAACo29JGAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U2' .
146 '9mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAOlSURBVHja7Jq9jtNAEMediAcwb2CuQIgGIx6A' .
147 '8ATHFVDQXNwc5SUdXZIOqoQSmoSGhoJQc1JyPehSIXQSIjxBwhOE2dM/0t4y+2F77Tgnj7Ry7Djr/X' .
148 'k+dmY3jc1mE9xUadRwNVz1pFnWgz42Gi1qK2rjG6U5AmrTQYZaUHvyYrNZ77XmoClVWzG1C/ou3kvN' .
149 '0cBDOgyptQ23raHBxd7AAWwGDdlEAHYJcFJ5szSACYiH1FQIcf8YflldOBpgpAETZndHmB+1hD4PmJ' .
150 '97B/RmlggOM2gisEVGJoJuZUD39iujOQPYRBfy4WMJzFWWnq+5MLfmTGAwwUJ/XxgcfOwi78AMgCPq' .
151 'p1s6nCEqZnrjBsAk6zSRCS4t2N179w/ocCBfu/z546xowKwBJa3GnlH7qrSACTJXkZUJMmKaeFo4HC' .
152 'KZCjbN6/wMIDcPxoXBUed9JldcIKR7EwAmTCYzg0v4hYNZ9FwmaAdZOQBO8gI2U0SyMZMrHjmCfbec' .
153 'mwBHTLk09AKHtzRmIpjQ2LLoehDz3FS53HbJQ10012MCSFJUDaaRBC4gy9AWYJoOftZhQv6kRLAApq' .
154 '/moaEm8bbDSeYoizDDbrADgaWoz44RwVNrrsf42VHRizoOAW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