Merge pull request #841 from openclassify/vedatakdogan

added exception
This commit is contained in:
Dia Shalabi 2020-12-01 11:27:41 +03:00 committed by GitHub
commit 55ea919f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 5 deletions

View File

@ -0,0 +1,21 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler;
class ExceptionHandler extends Handler
{
public function report(Exception $e)
{
if (app()->bound('sentry') && $this->shouldReport($e)) {
app('sentry')->captureException($e);
}
parent::report($e);
}
}

View File

@ -79,7 +79,8 @@
"visiosoft/integer-field_type": "~2.1.0",
"visiosoft/list-field_type": "*",
"guzzlehttp/guzzle": "~6.3.3",
"composer/composer": "^1.6"
"composer/composer": "^1.6",
"sentry/sentry-laravel": "*"
},
"replace": {
"anomaly/streams-platform": "*"

View File

@ -1,5 +1,8 @@
<?php
use Sentry\Laravel\Facade;
use Sentry\Laravel\ServiceProvider;
return [
/*
@ -209,6 +212,8 @@ return [
* Streams Service Provider
*/
Anomaly\Streams\Platform\StreamsServiceProvider::class,
Sentry\Laravel\ServiceProvider::class,
],
/*
@ -257,6 +262,8 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Sentry' => Sentry\Laravel\Facade::class,
],

36
config/sentry.php Normal file
View File

@ -0,0 +1,36 @@
<?php
return [
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
// capture release as git sha
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
// When left empty or `null` the Laravel environment will be used
'environment' => env('SENTRY_ENVIRONMENT'),
'breadcrumbs' => [
// Capture Laravel logs in breadcrumbs
'logs' => true,
// Capture SQL queries in breadcrumbs
'sql_queries' => true,
// Capture bindings on SQL queries logged in breadcrumbs
'sql_bindings' => true,
// Capture queue job information in breadcrumbs
'queue_info' => true,
// Capture command information in breadcrumbs
'command_info' => true,
],
// @see: https://docs.sentry.io/error-reporting/configuration/?platform=php#send-default-pii
'send_default_pii' => false,
'traces_sample_rate' => (float)(env('SENTRY_TRACES_SAMPLE_RATE', 1)),
'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'),
];

View File

@ -1,7 +1,9 @@
<?php
use App\Exceptions\ExceptionHandler;
return [
/*
|--------------------------------------------------------------------------
| Listeners
@ -22,7 +24,9 @@ return [
|
*/
'bindings' => [],
'bindings' => [
'Anomaly\Streams\Platform\Exception\ExceptionHandler' => ExceptionHandler::class
],
/*
|--------------------------------------------------------------------------
@ -118,7 +122,7 @@ return [
*/
'middleware_priority' => [],
/*
|--------------------------------------------------------------------------
| View Overrides
@ -129,7 +133,7 @@ return [
*/
'overrides' => [],
/*
|--------------------------------------------------------------------------
| Control Panel Customization