Comments (6)
Ah nice, that's nicer! Thanks! 😄
from sentry-laravel.
Actually, it was fairly easy to implement using the following code:
if (in_array(get_class($e), $this->dontReport, true)) {
parent::report($e);
return;
}
For for the trouble :)
from sentry-laravel.
You have to do this yourself, this is also done in the example applications.
/**
* 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 ($this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}
parent::report($exception);
}
from sentry-laravel.
Is there a nice way to do the same thing in Laravel 4.x? Right now, I just have the following in app/start/global.php:
App::error(function (Exception $exception, $code) {
// Add some extra context to Sentry
app('sentry')->user_context(array(
'ip_address' => Request::ip()
));
Log::error($exception);
});
from sentry-laravel.
@cviebrock in L5 it's just an array of exception with a helper method so you could do this:
You should check if that are the correct classes and namespaces and add some more maybe :) I cannot remember which there all are in L4.
/**
* Determine if the exception is in the "do not report" list.
*
* @param \Exception $e
* @return bool
*/
function shouldntReportException(Exception $e)
{
$dontReport = array(
'Illuminate\Http\Exception\HttpResponseException',
'Illuminate\Database\Eloquent\ModelNotFoundException',
'Symfony\Component\HttpKernel\Exception\HttpException',
'Symfony\Component\HttpKernel\Exception\NotFoundHttpException',
);
foreach ($dontReport as $type) {
if ($e instanceof $type) {
return true;
}
}
return false;
}
App::error(function (Exception $exception, $code) {
// Ignore all errors we don't care about
if (shouldntReportException($exception)) {
return;
}
// Add some extra context to Sentry
app('sentry')->user_context(array(
'ip_address' => Request::ip()
));
Log::error($exception);
});
from sentry-laravel.
That's what I figured I'd need to do (i.e. implement it myself). Thanks!
from sentry-laravel.
Related Issues (20)
- Add more spans outside http.route HOT 5
- Cron schedule not respection `between` HOT 6
- Failsafe system if Sentry goes down HOT 8
- In Tracing, is there consideration to add `sql.bindings` to `queryExecuted`? HOT 4
- Cron monitors not working HOT 6
- Send events after response was send to user. HOT 9
- `integrations` option does not accept callable
- Test event sent successfully but sentry web app not receiving it HOT 3
- Ignore exception "Prevent deadlock SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction" HOT 1
- `code.function` property contains full module path
- Call to undefined method Laravel\Lumen\Application::terminating() HOT 3
- sentry:test command sometimes works sometimes doesn't HOT 9
- Lumen does not have the `Illuminate\Routing\Events\RouteMatched event`. HOT 1
- Report missing translations
- Unable to set up sentry sdk debug logger option in Laravel 7 HOT 11
- Data not being send to Sentry HOT 2
- [Cron Monitoring] Whether to consider adding a switch configuration option for Cron monitoring? HOT 2
- Configure Cron Monitoring based on environment HOT 1
- Idle timeout reached HOT 4
- Scheduled task tracing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-laravel.