• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Sentry + Laravel: how to log an already catched Exception?

phplaravelsentry


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);

Related Snippets

Query Optimization, changing the queries in the loop into a single processing query

Laravel passport auth token not working after moving to different server

Laravel Collections. Is there some kind of assertStructure method?

How to get monthly wise data in laravel

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Passing a boolean value from checkbox in Laravel form

How to get quarter for future date using Carbon?

Utf8 encoding issue with Laravel

XSS attack still works despite htmlspecialchars() doing its work

Boolean assignment operators in PHP

Class AppHttpControllersUserController Does Not Exist

PHP Get value from JSON [duplicate]

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

Laravel database insert with combining array and string

Smarty if isset

About Contact Privacy policy Terms and conditions