• 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

Why is this PHP array not the same?

PHPExcel file download using AJAX call

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

How to send upload image through email

LARAVEL: How to fetch id dynamically in a query builder?

Fatal error: [] operator not supported for strings

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

How to reset Laravel AuthManager/guards in between API calls in tests?

Attempt to read property "view" on null when sending password reset email

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

What is PHP's equivalent of JavaScript's "array.every()"?

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Accessors (Getter) & Mutators (Setter) On a Pivot Table in Laravel

How to map the two arrays with a duplicate value?

About Contact Privacy policy Terms and conditions