Class ExceptionStrategy

Summary

Fully Qualified Name: Zend\Mvc\Console\View\ExceptionStrategy
Extends: AbstractListenerAggregate

Description

Methods

Name Description Defined By
attach() {@inheritDoc} ExceptionStrategy
detach() {@inheritDoc} AbstractListenerAggregate
displayExceptions() Should we display exceptions in error pages? ExceptionStrategy
getMessage() Get current template for message that will be shown in Console. ExceptionStrategy
getPreviousMessage() ExceptionStrategy
prepareExceptionViewModel() Create an exception view model, and set the HTTP status code ExceptionStrategy
setDisplayExceptions() Flag: display exceptions in error pages? ExceptionStrategy
setMessage() Set template for message that will be shown in Console. ExceptionStrategy
setPreviousMessage() Sets template for previous message that will be shown in Console. ExceptionStrategy

Method Details

attach()

{@inheritDoc}

Parameter Name Type Description
$events
$priority

Returns:

detach()

{@inheritDoc}

Parameter Name Type Description
$events

Returns:

displayExceptions()

Should we display exceptions in error pages?

Returns: bool

getMessage()

Get current template for message that will be shown in Console.

Returns: string

getPreviousMessage()

Returns: callable|string

prepareExceptionViewModel()

Create an exception view model, and set the HTTP status code

Parameter Name Type Description
$e \MvcEvent

Returns: void

setDisplayExceptions()

Flag: display exceptions in error pages?

Parameter Name Type Description
$displayExceptions bool

Returns: \ExceptionStrategy

setMessage()

Set template for message that will be shown in Console.

The message can be a string (template) or a callable (i.e. a closure).

The closure is expected to return a string and will be called with 2 parameters:

   Exception $exception           - the exception being thrown
   boolean   $displayExceptions   - whether to display exceptions or not

If the message is a string, one can use the following template params:

:className - full class name of exception instance :message - exception message :code - exception code :file - the file where the exception has been thrown :line - the line where the exception has been thrown :stack - full exception stack

Parameter Name Type Description
$message string|callable

Returns: \ExceptionStrategy

setPreviousMessage()

Sets template for previous message that will be shown in Console.

Parameter Name Type Description
$previousMessage string

Returns: \ExceptionStrategy

Top