From 1a221be19f688a0bac531a4537e85428145f7de8 Mon Sep 17 00:00:00 2001 From: Matteo Gheza Date: Sun, 8 Oct 2023 13:37:29 +0200 Subject: [PATCH] Ignore Json error as it's expected --- backend/app/Telegram/WebhookController.php | 2 +- backend/config/sentry.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/app/Telegram/WebhookController.php b/backend/app/Telegram/WebhookController.php index b48587b..2495908 100644 --- a/backend/app/Telegram/WebhookController.php +++ b/backend/app/Telegram/WebhookController.php @@ -30,7 +30,7 @@ class WebhookController extends if($this->user) return $this->user; try { $this->user = $this->message->from()->storage()->get('user', null); - } catch (\Exception $e) { + } catch (\Exception|\Throwable|\Error $e) { $this->user = null; } diff --git a/backend/config/sentry.php b/backend/config/sentry.php index 6476e31..8038882 100644 --- a/backend/config/sentry.php +++ b/backend/config/sentry.php @@ -56,6 +56,14 @@ return [ 'http_client_requests' => env('SENTRY_BREADCRUMBS_HTTP_CLIENT_REQUESTS_ENABLED', true), ], + 'before_send' => function (\Sentry\Event $event, ?\Sentry\EventHint $hint): ?\Sentry\Event { + if ($hint !== null && $hint->exception instanceof JsonException) { + return null; + } + + return $event; + }, + // Performance monitoring specific configuration 'tracing' => [ // Trace queue jobs as their own transactions (this enables tracing for queue jobs)