Anyone? My phone is going off endlessly because of these... and I'm thinking it will begin cutting into the limit
Jul 1, 2015
8
Level 9
Don't Report HttpException::class, Raven/Sentry
Hi everyone,
I'm using Raven/Sentry to catch errors from both a Lumen 5.1 and Laravel 5.1 app. I'm getting flooded with NotFoundHttpException (and other exceptions similar to that, such as 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'). I am using rcrowe/raven to capture Log::error() in my Handler.php, which in turn sends the exception to Sentry.
No matter what I've tried I cannot get these Not Found exceptions to stop. What am I missing? Here is my Handler.php, I've tried a variety of different things in $dontReport, this is the current state:
<?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Session\TokenMismatchException;
use Log;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\NotFoundHttpException',
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)
{
Log::error($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);
}
}
Please or to participate in this conversation.