From 22636fa21a2a62c4031b9c43e3e235333ca8bcfe Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Thu, 5 Sep 2024 22:26:52 +0800 Subject: [PATCH] don't send user errors to Sentry --- application/common/config/main.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/application/common/config/main.php b/application/common/config/main.php index d89e9855..3e44e810 100644 --- a/application/common/config/main.php +++ b/application/common/config/main.php @@ -1,11 +1,11 @@ user->isGuest) { + if ($appUser && !\Yii::$app->user->isGuest) { $prefixData['user'] = \Yii::$app->user->identity->email; } @@ -176,6 +176,11 @@ 'enabled' => !empty(Env::get('SENTRY_DSN')), 'dsn' => Env::get('SENTRY_DSN'), 'levels' => ['error'], + 'except' => [ + 'yii\web\HttpException:401', // Unauthorized + 'yii\web\HttpException:404', // NotFound + 'yii\web\HttpException:409', // Conflict + ], 'context' => true, // Additional options for `Sentry\init` // https://docs.sentry.io/platforms/php/configuration/options @@ -208,10 +213,10 @@ 'i18n' => [ 'translations' => [ '*' => [ - 'class' => 'yii\i18n\PhpMessageSource', - 'basePath' => '@frontend/messages', + 'class' => 'yii\i18n\PhpMessageSource', + 'basePath' => '@frontend/messages', 'sourceLanguage' => '00', - 'fileMap' => [ + 'fileMap' => [ 'app' => 'app.php', 'model' => 'model.php', ],