jenssegers / laravel-rollbar

Rollbar error monitoring integration for Laravel projects
328 stars 98 forks source link

Ignore some exceptions #32

Closed osaris closed 9 years ago

osaris commented 9 years ago

Hello,

I have set the level configuration to error and also the $dontReport variable in app/Exceptions/Handler.php but keep getting error tracking for 404 and wrong CSRF token.

    protected $dontReport = [
        'Symfony\Component\HttpKernel\Exception\HttpException',
        'Symfony\Component\HttpKernel\Exception\NotFoundHttpException',
        'Illuminate\Session\TokenMismatchException'
    ];

Can you help me to avoid reporting those errors ?

Regards

jenssegers commented 9 years ago

I'll have a look :)

jenssegers commented 9 years ago

Ran tests again for latest version and everything seems to still be ok. The don't report is something implemented by Laravel though, it has nothing to do with the handler.

osaris commented 9 years ago

So you put the exact same $dontReport as me and HttpException, NotFoundHttpException and TokenMismatchException aren't reported ?

jenssegers commented 9 years ago

Check out the parent implementation of report. They should use a method called shouldReport (or similar) there. You need to use that as well before you use Log::error

osaris commented 9 years ago

@jenssegers thanks, that did the trick.

Mastergalen commented 8 years ago

Ah, maybe add that to the Usage section of the README?

skydiver commented 8 years ago

If anyone still have problems, this was my final code (L5.1):

protected $dontReport = [
    HttpException::class,
    ModelNotFoundException::class,
];
public function report(Exception $e) {
    if($this->shouldReport($e)) {
        \Log::error($e);
    }
    return parent::report($e);
}
MladenJanjetovic commented 8 years ago

This should be in installation manual I guess:

public function report(Exception $e) {
    if($this->shouldReport($e)) {
        \Log::error($e);
    }

    return parent::report($e);
}
clin407 commented 7 years ago

Took me forever to figure this out, stumbled upon this link by the right choice of keywords. Should really add this to the installation guide.