@@ -128,11 +128,18 @@ public function onCheckedOut($event)
128128 ->notify ($ this ->getCheckoutNotification ($ event , $ acceptance ));
129129 }
130130 } catch (ClientException $ e ) {
131+ $ status = optional ($ e ->getResponse ()->getStatusCode ());
132+
131133 if (strpos ($ e ->getMessage (), 'channel_not_found ' ) !== false ) {
132134 Log::warning (Setting::getSettings ()->webhook_selected . " notification failed: " . $ e ->getMessage ());
133135 return redirect ()->back ()->with ('warning ' , ucfirst (Setting::getSettings ()->webhook_selected ) . trans ('admin/settings/message.webhook.webhook_channel_not_found ' ));
134136 } else {
135- Log::error ("ClientException caught during checkin notification: " . $ e ->getMessage ());
137+ if ($ status >= 500 || $ status === null ) {
138+ Log::error (Setting::getSettings ()->webhook_selected . " notification failed: " . $ e ->getMessage ());
139+ } else {
140+ Log::warning ("ClientException caught during checkin notification: " . $ e ->getMessage ());
141+ return redirect ()->back ()->with ('warning ' , ucfirst (Setting::getSettings ()->webhook_selected ) . trans ('admin/settings/message.webhook.webhook_fail ' ));
142+ }
136143 }
137144 return redirect ()->back ()->with ('warning ' , ucfirst (Setting::getSettings ()->webhook_selected ) . trans ('admin/settings/message.webhook.webhook_fail ' ));
138145 } catch (Exception $ e ) {
@@ -224,12 +231,18 @@ public function onCheckedIn($event)
224231 ->notify ($ this ->getCheckinNotification ($ event ));
225232 }
226233 } catch (ClientException $ e ) {
234+ $ status = optional ($ e ->getResponse ()->getStatusCode ());
235+
227236 if (strpos ($ e ->getMessage (), 'channel_not_found ' ) !== false ) {
228237 Log::warning (Setting::getSettings ()->webhook_selected . " notification failed: " . $ e ->getMessage ());
229238 return redirect ()->back ()->with ('warning ' , ucfirst (Setting::getSettings ()->webhook_selected ) . trans ('admin/settings/message.webhook.webhook_channel_not_found ' ));
230239 } else {
231- Log::error ("ClientException caught during checkin notification: " . $ e ->getMessage ());
232- return redirect ()->back ()->with ('warning ' , ucfirst (Setting::getSettings ()->webhook_selected ) . trans ('admin/settings/message.webhook.webhook_fail ' ));
240+ if ($ status >= 500 || $ status === null ) {
241+ Log::error (Setting::getSettings ()->webhook_selected . " notification failed: " . $ e ->getMessage ());
242+ } else {
243+ Log::warning ("ClientException caught during checkin notification: " . $ e ->getMessage ());
244+ return redirect ()->back ()->with ('warning ' , ucfirst (Setting::getSettings ()->webhook_selected ) . trans ('admin/settings/message.webhook.webhook_fail ' ));
245+ }
233246 }
234247 } catch (Exception $ e ) {
235248 Log::warning (ucfirst (Setting::getSettings ()->webhook_selected ) . ' webhook notification failed: ' , [
0 commit comments