Trick to create exception handler class :: Part 1 :: Report() to raise exception

Submitted by harshaldosh - 3 years ago

# Report(): The report() method allows us to log the raised exceptions or parse them to various error logging engines like the sentry. All this method does by default is passing the thrown exception to the base class where it is logged, but we are free to customize.

public function report(Exception $exception)
    if ($exception instanceof CustomException) {

    return parent::report($exception);