Search

Laravel 5: Reporting Application Exceptions With report

April 14, 2018 —John Koster

The report function is used to report an exception to the applications exception handler. By default, the application exception handler is located at app/Exceptions/Handler.php. The report function will invoke the report method of the application exception handler with the provided exception.

#Signature

The signature of the report function is:

1function report(
2 $exception
3);

#Example Use

The following example demonstrates how to report an exception to the application's exception handler using the report helper function:

1try {
2 // Attempt some operation that throws exceptions.
3} catch (Exception $e) {
4 
5 // Report the exception.
6 report($e);
7 
8 // Perform some action with the exception.
9}