• 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

Add and update products to session cart in Laravel

how to fix Service provider class not found when using repository?

Can we define variables in `.tpl` files?

how to redirect the user back to desired URL after login page in PHP?

How to loop a tree array with unknown depth and get array blocks?

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Use Python plotly chart in PHP

Use same method for inertia response and json response Laravel Jetstream

Add rows to Single product Additional information table in WooCommerce 3.6

Move a child array to parent array and change parent/child name

Alert message after submitting form in PHP

JSON Render Issue in Date Object Laravel and PHP 7.4

Multiply each value in array using array_map function

How to fix Call to undefined method AppModelsTableName::factory?

Shortcode or PHP inside a shortcode in Wordpress

About Contact Privacy policy Terms and conditions