I'm using Laravel 5.x ... 7.x
I ask you if there is a way to log via Sentry an already captured Exception, in a catch block I mean.
This is normally done with:
try{
// ...
} catch(\Throwable $e) {
captureException($e);
}
If the exception does not rise, it's not captured automatically. For other details, @stayallive knows more since he maintains sentry-laravel.
^ this is the way to do this.
If you want to use the Laravel container it could look more like this:
try {
// your code that could throw an exception
} catch (\Throwable $e) {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
}
}
You can also use which should also log the exception to your log files:
try {
// your code that could throw an exception
} catch (\Throwable $e) {
report($e); // this is a Laravel helper, not from Sentry
}
Your choice what makes the most sense in your situation.
It works thanks.
I cannot find it in the documentation, if missing I suggest to addd
It's here so I think we got it covered :)
Thanks for all help.
I was looking only into api doc, thanks for pointing me to right doc page