class ProductionExceptionHandler extends AbstractExceptionHandler (View source)

A quite exception handler which catches but ignores any exception.

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

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)

Echoes an exception for the web.

buildView(Throwable $exception, array $renderingOptions)

Prepares a view for rendering the custom error page.

array
resolveCustomRenderingOptions(Throwable $exception)

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

string|null
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, bool $exceptionWasLogged)

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

string
renderStatically(int $statusCode, string|null $referenceCode)

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)

Echoes an exception for the web.

Parameters

Throwable $exception

Return Value

void

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

Prepares a view for rendering the custom error page.

Parameters

Throwable $exception
array $renderingOptions

Rendering options as defined in the settings

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 the default

protected string|null resolveRenderingGroup(Throwable $exception)

No description

Parameters

Throwable $exception

Return Value

string|null

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.

Return Value

bool

protected void echoExceptionCli(Throwable $exception, bool $exceptionWasLogged)

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

Parameters

Throwable $exception
bool $exceptionWasLogged

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 string renderStatically(int $statusCode, string|null $referenceCode)

Returns the statically rendered exception message

Parameters

int $statusCode
string|null $referenceCode

Return Value

string