It was either the fact that I was using a Whoops package, my bootstrap/app.php from 5.0 being different from 5.1 (another missing piece from upgrade instructions), or a combination of the two.
Jun 25, 2015
1
Level 9
ExceptionHandler overrides not working
Hi everyone,
I'm trying to get Raven/Sentry bug tracking working in my Laravel 5.1 app. I started out by trying jenssegers/laravel-raven, https://github.com/jenssegers/laravel-raven, but it is very sporadic - only reporting two out of several errors.
I tried to directly call Sentry from within App/Exceptions/Handler.php but it seems like no matter what I add to the methods in this file, they're completely ignored. Even a dd('Foobar') in the report() method does nothing.
<?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Session\TokenMismatchException;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
HttpException::class,
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
$client = new \Raven_Client('dsn');
$client->captureException($e);
return parent::report($e);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if ($e instanceof TokenMismatchException) {
//Redirect to login form if session expires
return redirect($request->fullUrl())->with('errors',
"The login form has expired, please try again. In the future, reload the login page if it has been open for several hours.");
}
return parent::render($request, $e);
}
}
Any ideas??
Please or to participate in this conversation.