Skip to content

Commit

Permalink
add: sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
falstack committed Jul 31, 2019
1 parent 672eaab commit c68f140
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ class Handler extends ExceptionHandler
*/
public function report(Exception $e)
{
if (app()->bound('sentry') && $this->shouldReport($e))
{
app('sentry')->captureException($e);

if (app()->runningInConsole())
{
app('sentry')
->getClient()
->getIntegration(\Sentry\Laravel\Integration::class)
->flushEvents();
}
}

parent::report($e);
}

Expand Down
1 change: 1 addition & 0 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
$app->register(Barryvdh\Cors\ServiceProvider::class);
$app->register(Spatie\Permission\PermissionServiceProvider::class);
$app->register(Yansongda\LaravelPay\PayServiceProvider::class);
$app->register(Sentry\Laravel\ServiceProvider::class);

/*
|--------------------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions config/sentry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'dsn' => env('SENTRY_DSN'),
];

0 comments on commit c68f140

Please sign in to comment.