W3cubDocs

/Symfony 2.7

Symfony\Component\HttpKernel\Debug\ExceptionHandler

class ExceptionHandler extends ExceptionHandler

ExceptionHandler converts an exception to a Response object.

Methods

__construct($debug = true, $charset = 'UTF-8') from ExceptionHandler
static ExceptionHandler register(Boolean $debug = true)

Registers the exception handler.

from ExceptionHandler
handle(Exception $exception)

Sends a response for the given Exception.

from ExceptionHandler
sendPhpResponse(Exception|FlattenException $exception)

Sends the error associated with the given Exception as a plain PHP response.

from ExceptionHandler
Response createResponse(Exception|FlattenException $exception)

Creates the error Response associated with the given Exception.

from ExceptionHandler
string getContent(FlattenException $exception)

Gets the HTML content associated with the given exception.

from ExceptionHandler
string getStylesheet(FlattenException $exception)

Gets the stylesheet associated with the given exception.

from ExceptionHandler

Details

public __construct($debug = true, $charset = 'UTF-8')

Parameters

$debug
$charset

static public ExceptionHandler register(Boolean $debug = true)

Registers the exception handler.

Parameters

Boolean $debug

Return Value

ExceptionHandler The registered exception handler

public handle(Exception $exception)

Sends a response for the given Exception.

If you have the Symfony HttpFoundation component installed, this method will use it to create and send the response. If not, it will fallback to plain PHP functions.

Parameters

Exception $exception An \Exception instance

See also

sendPhpResponse
createResponse

public sendPhpResponse(Exception|FlattenException $exception)

Sends the error associated with the given Exception as a plain PHP response.

This method uses plain PHP functions like header() and echo to output the response.

Parameters

Exception|FlattenException $exception An \Exception instance

public Response createResponse(Exception|FlattenException $exception)

Creates the error Response associated with the given Exception.

Parameters

Exception|FlattenException $exception An \Exception instance

Return Value

Response A Response instance

public string getContent(FlattenException $exception)

Gets the HTML content associated with the given exception.

Parameters

FlattenException $exception A FlattenException instance

Return Value

string The content as a string

public string getStylesheet(FlattenException $exception)

Gets the stylesheet associated with the given exception.

Parameters

FlattenException $exception A FlattenException instance

Return Value

string The stylesheet as a string

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Component/HttpKernel/Debug/ExceptionHandler.html