• 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

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

Detect a fetch request in PHP

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

renameColumn migration fails for existing column with columns does not exist error

Prestashop cUrl Login

PHP sort array of objects by two properties

Unable to run composer install

Search for array row with specific column value and return another value from qualifying row

WooCommerce Additional Information - if empty, hide

How to map the two arrays with a duplicate value?

Can I use a WooCommerce function without any WooCommerce page?

How to MODIFY a Google Docs document via API using search-and-replace?

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

Adding custom body class to the custom archive pages

Override default Auth routes in Laravel 7

About Contact Privacy policy Terms and conditions