class DebugExceptionHandler extends AbstractExceptionHandler (View source)

A basic but solid exception handler which catches everything which falls through the other exception handlers and provides useful debugging information.

Properties

protected LoggerInterface $logger from  AbstractExceptionHandler
protected ThrowableStorageInterface $throwableStorage from  AbstractExceptionHandler
protected array $options from  AbstractExceptionHandler
protected $renderingOptions

Merged custom error view options from defaultRenderingOptions and of the first matching renderingGroup

from  AbstractExceptionHandler
protected string $htmlExceptionTemplate

The template for the HTML Exception output.

Methods

void
injectLogger(LoggerInterface $logger)

No description

void
setOptions(array $options)

Sets options of this exception handler.

__construct()

Constructs this exception handler - registers itself as the default exception handler.

void
handleException(object $exception)

Handles the given exception

void
echoExceptionWeb(Throwable $exception)

Formats and echoes the exception as XHTML.

buildView(Throwable $exception, array $renderingOptions)

Prepares a Fluid view for rendering the custom error page.

applyLegacyViewOptions(ViewInterface $view, array $renderingOptions)

Sets legacy "option" properties to the view for backwards compatibility.

array
resolveCustomRenderingOptions(Throwable $exception)

Checks if custom rendering rules apply to the given $exception and returns those.

string
resolveRenderingGroup(Throwable $exception)

No description

bool
useCustomErrorView()

If a renderingGroup was successfully resolved via resolveRenderingGroup We will use a custom error view.

void
echoExceptionCli(Throwable $exception)

Formats and echoes the exception and its previous exceptions (if any) for the command line

string
renderNestedExceptonsCli(Throwable $exception, string $exceptionMessage)

No description

string
renderSingleExceptionCli(Throwable $exception)

Renders a single exception including message, code and affected file

string
renderExceptionDetailCli(string $label, string $value)

Renders the given $value word-wrapped and prefixed with $label

array
splitExceptionMessage(string $exceptionMessage)

Splits the given string into subject and body according to following rules:

  • If the string is empty or does not contain more than one sentence nor line breaks, the subject will be equal to the string and body will be an empty string
  • Otherwise the subject is everything until the first line break or end of sentence, the body contains the rest

void
renderStatically(int $statusCode, Throwable $exception)

Returns the statically rendered exception message

Details

void injectLogger(LoggerInterface $logger)

No description

Parameters

LoggerInterface $logger

Return Value

void

injectThrowableStorage(ThrowableStorageInterface $throwableStorage)

No description

Parameters

ThrowableStorageInterface $throwableStorage

void setOptions(array $options)

Sets options of this exception handler.

Parameters

array $options

Return Value

void

__construct()

Constructs this exception handler - registers itself as the default exception handler.

void handleException(object $exception)

Handles the given exception

Parameters

object $exception

The exception object - can be \Exception, or some type of \Throwable in PHP 7

Return Value

void

protected void echoExceptionWeb(Throwable $exception)

Formats and echoes the exception as XHTML.

Parameters

Throwable $exception

Return Value

void

protected ViewInterface buildView(Throwable $exception, array $renderingOptions)

Prepares a Fluid view for rendering the custom error page.

Parameters

Throwable $exception
array $renderingOptions

Rendering options as defined in the settings

Return Value

ViewInterface

protected ViewInterface applyLegacyViewOptions(ViewInterface $view, array $renderingOptions)

Sets legacy "option" properties to the view for backwards compatibility.

Parameters

ViewInterface $view
array $renderingOptions

Return Value

ViewInterface

protected array resolveCustomRenderingOptions(Throwable $exception)

Checks if custom rendering rules apply to the given $exception and returns those.

Parameters

Throwable $exception

Return Value

array

the custom rendering options, or NULL if no custom rendering is defined for this exception

protected string resolveRenderingGroup(Throwable $exception)

No description

Parameters

Throwable $exception

Return Value

string

name of the resolved renderingGroup or NULL if no group could be resolved

protected bool useCustomErrorView()

If a renderingGroup was successfully resolved via resolveRenderingGroup We will use a custom error view.

Also check for legacy 'templatePathAndFilename'

Return Value

bool

protected void echoExceptionCli(Throwable $exception)

Formats and echoes the exception and its previous exceptions (if any) for the command line

Parameters

Throwable $exception

Return Value

void

protected string renderNestedExceptonsCli(Throwable $exception, string $exceptionMessage)

No description

Parameters

Throwable $exception
string $exceptionMessage

Return Value

string

protected string renderSingleExceptionCli(Throwable $exception)

Renders a single exception including message, code and affected file

Parameters

Throwable $exception

Return Value

string

protected string renderExceptionDetailCli(string $label, string $value)

Renders the given $value word-wrapped and prefixed with $label

Parameters

string $label
string $value

Return Value

string

protected array splitExceptionMessage(string $exceptionMessage)

Splits the given string into subject and body according to following rules:

  • If the string is empty or does not contain more than one sentence nor line breaks, the subject will be equal to the string and body will be an empty string
  • Otherwise the subject is everything until the first line break or end of sentence, the body contains the rest

Parameters

string $exceptionMessage

Return Value

array

in the format array('subject' => '', 'body' => '');

protected void renderStatically(int $statusCode, Throwable $exception)

Returns the statically rendered exception message

Parameters

int $statusCode
Throwable $exception

Return Value

void