added exception

This commit is contained in:
vedatakdogan 2020-11-30 18:07:59 +03:00
parent 3a5be3b62f
commit fb710111cb
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/integer-field_type": "~2.1.0",
"visiosoft/list-field_type": "*", "visiosoft/list-field_type": "*",
"guzzlehttp/guzzle": "~6.3.3", "guzzlehttp/guzzle": "~6.3.3",
"composer/composer": "^1.6" "composer/composer": "^1.6",
"sentry/sentry-laravel": "*"
}, },
"replace": { "replace": {
"anomaly/streams-platform": "*" "anomaly/streams-platform": "*"

View File

@ -1,5 +1,8 @@
<?php <?php
use Sentry\Laravel\Facade;
use Sentry\Laravel\ServiceProvider;
return [ return [
/* /*
@ -209,6 +212,8 @@ return [
* Streams Service Provider * Streams Service Provider
*/ */
Anomaly\Streams\Platform\StreamsServiceProvider::class, Anomaly\Streams\Platform\StreamsServiceProvider::class,
Sentry\Laravel\ServiceProvider::class,
], ],
/* /*
@ -257,6 +262,8 @@ return [
'URL' => Illuminate\Support\Facades\URL::class, 'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class, 'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::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,5 +1,7 @@
<?php <?php
use App\Exceptions\ExceptionHandler;
return [ return [
/* /*
@ -22,7 +24,9 @@ return [
| |
*/ */
'bindings' => [], 'bindings' => [
'Anomaly\Streams\Platform\Exception\ExceptionHandler' => ExceptionHandler::class
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------