AbstractExceptionHandler
abstract class AbstractExceptionHandler implements ExceptionHandlerInterface (View source)
An abstract exception handler
Properties
protected LoggerInterface | $logger | ||
protected ThrowableStorageInterface | $throwableStorage | ||
protected array | $options | ||
protected | $renderingOptions | Merged custom error view options from defaultRenderingOptions and of the first matching renderingGroup |
Methods
No description
Sets options of this exception handler.
Constructs this exception handler - registers itself as the default exception handler.
Handles the given exception
Checks if custom rendering rules apply to the given $exception and returns those.
If a renderingGroup was successfully resolved via resolveRenderingGroup We will use a custom error view.
Formats and echoes the exception and its previous exceptions (if any) for the command line
Renders a single exception including message, code and affected file
Renders the given $value word-wrapped and prefixed with $label
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
Details
void
injectLogger(LoggerInterface $logger)
No description
injectThrowableStorage(ThrowableStorageInterface $throwableStorage)
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
abstract protected void
echoExceptionWeb(Throwable $exception)
Echoes an exception for the web.
protected ViewInterface
buildView(Throwable $exception, array $renderingOptions)
Prepares a view for rendering the custom error page.
protected array
resolveCustomRenderingOptions(Throwable $exception)
Checks if custom rendering rules apply to the given $exception and returns those.
protected string|null
resolveRenderingGroup(Throwable $exception)
No description
protected bool
useCustomErrorView()
If a renderingGroup was successfully resolved via resolveRenderingGroup We will use a custom error view.
protected void
echoExceptionCli(Throwable $exception, bool $exceptionWasLogged)
Formats and echoes the exception and its previous exceptions (if any) for the command line
protected string
renderNestedExceptonsCli(Throwable $exception, string $exceptionMessage)
No description
protected string
renderSingleExceptionCli(Throwable $exception)
Renders a single exception including message, code and affected file
protected string
renderExceptionDetailCli(string $label, string $value)
Renders the given $value word-wrapped and prefixed with $label
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