HandleExceptions

class HandleExceptions (View source)

Properties

protected Application $app The application instance.

Methods

void bootstrap(Application $app)

Bootstrap the given application.

void handleError(int $level, string $message, string $file = '', int $line = 0, array $context = [])

Convert PHP errors to ErrorException instances.

void handleException(Throwable $e)

Handle an uncaught exception from the application.

void renderForConsole(Exception $e)

Render an exception to the console.

void renderHttpResponse(Exception $e)

Render an exception as an HTTP response and send it.

void handleShutdown()

Handle the PHP shutdown event.

FatalErrorException fatalExceptionFromError(array $error, int|null $traceOffset = null)

Create a new fatal exception instance from an error array.

bool isFatal(int $type)

Determine if the error type is fatal.

ExceptionHandler getExceptionHandler()

Get an instance of the exception handler.

Details

void bootstrap(Application $app)

Bootstrap the given application.

Parameters

Application $app

Return Value

void

void handleError(int $level, string $message, string $file = '', int $line = 0, array $context = [])

Convert PHP errors to ErrorException instances.

Parameters

int $level
string $message
string $file
int $line
array $context

Return Value

void

Exceptions

ErrorException

void handleException(Throwable $e)

Handle an uncaught exception from the application.

Note: Most exceptions can be handled via the try / catch block in the HTTP and Console kernels. But, fatal error exceptions must be handled differently since they are not normal exceptions.

Parameters

Throwable $e

Return Value

void

protected void renderForConsole(Exception $e)

Render an exception to the console.

Parameters

Exception $e

Return Value

void

protected void renderHttpResponse(Exception $e)

Render an exception as an HTTP response and send it.

Parameters

Exception $e

Return Value

void

void handleShutdown()

Handle the PHP shutdown event.

Return Value

void

protected FatalErrorException fatalExceptionFromError(array $error, int|null $traceOffset = null)

Create a new fatal exception instance from an error array.

Parameters

array $error
int|null $traceOffset

Return Value

FatalErrorException

protected bool isFatal(int $type)

Determine if the error type is fatal.

Parameters

int $type

Return Value

bool

protected ExceptionHandler getExceptionHandler()

Get an instance of the exception handler.

Return Value

ExceptionHandler

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.7/Illuminate/Foundation/Bootstrap/HandleExceptions.html