public static function handle(Exception $exception)
    {
        // Sometimes errors thrown before subsystem is ready - in this case its always told to outside but logged
        $debug = (true === defined('DOOZR_DEBUGGING')) ? DOOZR_DEBUGGING : true;

        // In range of 100 - 599 we do send a HTTP response by logic and laws of Doozr
        if ($exception->getCode() < 100 || $exception->getCode() > 599) {
            $statusCode = 500;
        } else {
            $statusCode = $exception->getCode();
        }

        // Information disclosure protection. Only in debug we show what really happened
        if (true === $debug) {
            $message = $exception->getMessage();
            $code    = $exception->getCode();
        } else {
            $message = constant('Doozr_Http::REASONPHRASE_'.$statusCode);
            $code    = $statusCode;
        }

        // Simple exception switch by runtime environment
        if (Doozr_Kernel::RUNTIME_ENVIRONMENT_WEB === DOOZR_RUNTIME_ENVIRONMENT) {
            self::handleHtml(
                $statusCode,
                $code,
                $message,
                $exception->getFile(),
                $exception->getLine()
            );
        } else {
            self::handleText(
                $code,
                $message,
                $exception->getFile(),
                $exception->getLine()
            );
        }
    }
public static function handle(Exception $exception)
    {
        // Sometimes errors thrown before subsystem is ready - in this case its always told to outside but logged
        $debug = (true === defined('DOOZR_DEBUGGING')) ? DOOZR_DEBUGGING : true;

        // In range of 100 - 599 we do send a HTTP response by logic and laws of Doozr
        if ($exception->getCode() < 100 || $exception->getCode() > 599) {
            $statusCode = 500;
        } else {
            $statusCode = $exception->getCode();
        }

        // Information disclosure protection. Only in debug we show what really happened
        if (true === $debug) {
            $message = $exception->getMessage();
            $code    = $exception->getCode();
        } else {
            $message = constant('Doozr_Http::REASONPHRASE_'.$statusCode);
            $code    = $statusCode;
        }

        // Simple exception switch by runtime environment
        if (Doozr_Kernel::RUNTIME_ENVIRONMENT_WEB === DOOZR_RUNTIME_ENVIRONMENT) {
            self::handleHtml(
                $statusCode,
                $code,
                $message,
                $exception->getFile(),
                $exception->getLine()
            );
        } else {
            self::handleText(
                $code,
                $message,
                $exception->getFile(),
                $exception->getLine()
            );
        }
    }
public static function handle ( Exception $ exception ) { // Sometimes errors thrown before subsystem is ready - in this case its always told to outside but logged $ debug = ( true === defined ( 'DOOZR_DEBUGGING' ) ) ? DOOZR_DEBUGGING : true ; // In range of 100 - 599 we do send a HTTP response by logic and laws of Doozr if ( $ exception -> getCode ( ) < 100 || $ exception -> getCode ( ) > 599 ) { $ statusCode = 500 ; } else { $ statusCode = $ exception -> getCode ( ) ; } // Information disclosure protection. Only in debug we show what really happened if ( true === $ debug ) { $ message = $ exception -> getMessage ( ) ; $ code = $ exception -> getCode ( ) ; } else { $ message = constant ( 'Doozr_Http::REASONPHRASE_' . $ statusCode ) ; $ code = $ statusCode ; } // Simple exception switch by runtime environment if ( Doozr_Kernel :: RUNTIME_ENVIRONMENT_WEB === DOOZR_RUNTIME_ENVIRONMENT ) { self :: handleHtml ( $ statusCode , $ code , $ message , $ exception -> getFile ( ) , $ exception -> getLine ( ) ) ; } else { self :: handleText ( $ code , $ message , $ exception -> getFile ( ) , $ exception -> getLine ( ) ) ; } }
Replacement for PHP's default internal exception handler. All Exceptions are forwarded
to this method - we decide here what to do with it.
We need this hook to stay informed about Doozr's state and to pipe the Exceptions to
attached Logger-Subsystem.

@param Exception $exception The thrown and uncaught exception object

@author Benjamin Carl <opensource@clickalicious.de>
@static
Replacement for PHP s default internal exception handler . All Exceptions are forwarded to this method - we decide here what to do with it . We need this hook to stay informed about Doozr s state and to pipe the Exceptions to attached Logger - Subsystem .