protected function defaultError($e)
    {
        $this->contentType('text/html');

        if ($this['mode'] === 'development') {
            $title = 'Slim Application Error';
            $html = '';

            if ($e instanceof \Exception) {
                $code = $e->getCode();
                $message = $e->getMessage();
                $file = $e->getFile();
                $line = $e->getLine();
                $trace = str_replace(array('#', '\n'), array('<div>#', '</div>'), $e->getTraceAsString());

                $html = '<p>The application could not run because of the following error:</p>';
                $html .= '<h2>Details</h2>';
                $html .= sprintf('<div><strong>Type:</strong> %s</div>', get_class($e));
                if ($code) {
                    $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
                }
                if ($message) {
                    $html .= sprintf('<div><strong>Message:</strong> %s</div>', $message);
                }
                if ($file) {
                    $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
                }
                if ($line) {
                    $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
                }
                if ($trace) {
                    $html .= '<h2>Trace</h2>';
                    $html .= sprintf('<pre>%s</pre>', $trace);
                }
            } else {
                $html = sprintf('<p>%s</p>', $e);
            }

            echo self::generateTemplateMarkup($title, $html);
        } else {
            echo self::generateTemplateMarkup(
                'Error',
                '<p>A website error has occurred. The website administrator has been notified of the issue. Sorry'
                . 'for the temporary inconvenience.</p>'
            );
        }
    }
protected function defaultError($e)
    {
        $this->contentType('text/html');

        if ($this['mode'] === 'development') {
            $title = 'Slim Application Error';
            $html = '';

            if ($e instanceof \Exception) {
                $code = $e->getCode();
                $message = $e->getMessage();
                $file = $e->getFile();
                $line = $e->getLine();
                $trace = str_replace(array('#', '\n'), array('<div>#', '</div>'), $e->getTraceAsString());

                $html = '<p>The application could not run because of the following error:</p>';
                $html .= '<h2>Details</h2>';
                $html .= sprintf('<div><strong>Type:</strong> %s</div>', get_class($e));
                if ($code) {
                    $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
                }
                if ($message) {
                    $html .= sprintf('<div><strong>Message:</strong> %s</div>', $message);
                }
                if ($file) {
                    $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
                }
                if ($line) {
                    $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
                }
                if ($trace) {
                    $html .= '<h2>Trace</h2>';
                    $html .= sprintf('<pre>%s</pre>', $trace);
                }
            } else {
                $html = sprintf('<p>%s</p>', $e);
            }

            echo self::generateTemplateMarkup($title, $html);
        } else {
            echo self::generateTemplateMarkup(
                'Error',
                '<p>A website error has occurred. The website administrator has been notified of the issue. Sorry'
                . 'for the temporary inconvenience.</p>'
            );
        }
    }
protected function defaultError ( $ e ) { $ this -> contentType ( 'text/html' ) ; if ( $ this [ 'mode' ] === 'development' ) { $ title = 'Slim Application Error' ; $ html = '' ; if ( $ e instanceof \ Exception ) { $ code = $ e -> getCode ( ) ; $ message = $ e -> getMessage ( ) ; $ file = $ e -> getFile ( ) ; $ line = $ e -> getLine ( ) ; $ trace = str_replace ( array ( '#' , '\n' ) , array ( '<div>#' , '</div>' ) , $ e -> getTraceAsString ( ) ) ; $ html = '<p>The application could not run because of the following error:</p>' ; $ html .= '<h2>Details</h2>' ; $ html .= sprintf ( '<div><strong>Type:</strong> %s</div>' , get_class ( $ e ) ) ; if ( $ code ) { $ html .= sprintf ( '<div><strong>Code:</strong> %s</div>' , $ code ) ; } if ( $ message ) { $ html .= sprintf ( '<div><strong>Message:</strong> %s</div>' , $ message ) ; } if ( $ file ) { $ html .= sprintf ( '<div><strong>File:</strong> %s</div>' , $ file ) ; } if ( $ line ) { $ html .= sprintf ( '<div><strong>Line:</strong> %s</div>' , $ line ) ; } if ( $ trace ) { $ html .= '<h2>Trace</h2>' ; $ html .= sprintf ( '<pre>%s</pre>' , $ trace ) ; } } else { $ html = sprintf ( '<p>%s</p>' , $ e ) ; } echo self :: generateTemplateMarkup ( $ title , $ html ) ; } else { echo self :: generateTemplateMarkup ( 'Error' , '<p>A website error has occurred. The website administrator has been notified of the issue. Sorry' . 'for the temporary inconvenience.</p>' ) ; } }
Default Error handler
Default Error handler