The Exception Handler: The Report Method

Is used to log exceptions or send them to an external service like Bugsnag or Sentry.

/**
 * Report or log an exception.
 *
 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
 *
 * @param  \Exception  $exception
 * @return void
 */
public function report(Exception $exception)
{
    if ($exception instanceof CustomException) {
        //
    }

    return parent::report($exception);
}

Passes the exception to the base class where the exception is logged.

The report Helper

Public function isValid($value)
{
    try {
        // Validate the value...
    } catch (Exception $e) {
        report($e);

        return false;
    }
}

Allows you to quickly report an exception using your exception handler's report method without rendering an error page.

Ignoring Exceptions By Type

/**
 * A list of the exception types that should not be reported.
 *
 * @var array
 */
protected $dontReport = [
    \Illuminate\Auth\AuthenticationException::class,
    \Illuminate\Auth\Access\AuthorizationException::class,
    \Symfony\Component\HttpKernel\Exception\HttpException::class,
    \Illuminate\Database\Eloquent\ModelNotFoundException::class,
    \Illuminate\Validation\ValidationException::class,
];

The Exception Handler: The Report Method — Structure map

Clickable & Draggable!

The Exception Handler: The Report Method — Related pages: