//ads:
?>
Sentry + Laravel: how to log an already catched Exception?
PHP Snippet 1:
try {
// your code that could throw an exception
} catch (\Throwable $e) {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
}
}
PHP Snippet 2:
try {
// your code that could throw an exception
} catch (\Throwable $e) {
report($e); // this is a Laravel helper, not from Sentry
}
PHP Snippet 3:
\Sentry\captureMessage("This handle a text message");
// this handle everything derives from \Exception
\Sentry\captureException($e);