From 0ab206ca13f5dd0ee41ab134b78612fefd117f8e Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 8 Jan 2026 09:47:35 -0800 Subject: [PATCH 1/2] log warnings instead of errors for 4xx status codes --- app/Listeners/CheckoutableListener.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 908dd58dfd..6c231a6c38 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -39,6 +39,7 @@ use Exception; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use Osama\LaravelTeamsNotification\TeamsNotification; +use function Laravel\Prompts\error; class CheckoutableListener { @@ -128,11 +129,18 @@ class CheckoutableListener ->notify($this->getCheckoutNotification($event, $acceptance)); } } catch (ClientException $e) { + $status = optional($e->getResponse()->getStatusCode()); + if (strpos($e->getMessage(), 'channel_not_found') !== false) { Log::warning(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_channel_not_found')); } else { - Log::error("ClientException caught during checkin notification: " . $e->getMessage()); + if ($status >= 500 || $status === null) { + Log:error(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); + } else { + Log::warning("ClientException caught during checkin notification: " . $e->getMessage()); + return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail')); + } } return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail')); } catch (Exception $e) { @@ -224,12 +232,18 @@ class CheckoutableListener ->notify($this->getCheckinNotification($event)); } } catch (ClientException $e) { + $status = optional($e->getResponse()->getStatusCode()); + if (strpos($e->getMessage(), 'channel_not_found') !== false) { Log::warning(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_channel_not_found')); } else { - Log::error("ClientException caught during checkin notification: " . $e->getMessage()); - return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail')); + if ($status >= 500 || $status === null) { + Log:error(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); + } else { + Log::warning("ClientException caught during checkin notification: " . $e->getMessage()); + return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail')); + } } } catch (Exception $e) { Log::warning(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [ From 0327d01287c7020d95440caa4a7d81412c6ac8c9 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Thu, 8 Jan 2026 10:52:27 -0800 Subject: [PATCH 2/2] typo fixes" --- app/Listeners/CheckoutableListener.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 6c231a6c38..f80f16eb32 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -39,7 +39,6 @@ use Exception; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use Osama\LaravelTeamsNotification\TeamsNotification; -use function Laravel\Prompts\error; class CheckoutableListener { @@ -136,7 +135,7 @@ class CheckoutableListener return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_channel_not_found')); } else { if ($status >= 500 || $status === null) { - Log:error(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); + Log::error(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); } else { Log::warning("ClientException caught during checkin notification: " . $e->getMessage()); return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail')); @@ -239,7 +238,7 @@ class CheckoutableListener return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_channel_not_found')); } else { if ($status >= 500 || $status === null) { - Log:error(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); + Log::error(Setting::getSettings()->webhook_selected . " notification failed: " . $e->getMessage()); } else { Log::warning("ClientException caught during checkin notification: " . $e->getMessage()); return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail'));