Skip to content

Commit 39ce7b7

Browse files
authored
Merge pull request grokability#16175 from Godmartinz/channel-not-found-warning-added
2 parents 5e363f7 + cbf9239 commit 39ce7b7

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

app/Listeners/CheckoutableListener.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ public function onCheckedOut($event)
106106
}
107107
}
108108
} catch (ClientException $e) {
109-
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
109+
if (strpos($e->getMessage(), 'channel_not_found') !== false) {
110+
Log::warning(Setting::getSettings()->webhook_selected." notification failed: " . $e->getMessage());
111+
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_channel_not_found') );
112+
}
113+
else {
114+
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
115+
}
110116
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail') );
111117
} catch (Exception $e) {
112118
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
@@ -196,8 +202,14 @@ public function onCheckedIn($event)
196202
}
197203
}
198204
} catch (ClientException $e) {
199-
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
200-
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_fail'));
205+
if (strpos($e->getMessage(), 'channel_not_found') !== false) {
206+
Log::warning(Setting::getSettings()->webhook_selected." notification failed: " . $e->getMessage());
207+
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) .trans('admin/settings/message.webhook.webhook_channel_not_found') );
208+
}
209+
else {
210+
Log::error("ClientException caught during checkin notification: " . $e->getMessage());
211+
return redirect()->back()->with('warning', ucfirst(Setting::getSettings()->webhook_selected) . trans('admin/settings/message.webhook.webhook_fail'));
212+
}
201213
} catch (Exception $e) {
202214
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
203215
'error' => $e->getMessage(),

resources/lang/en-US/admin/settings/message.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
'error_redirect' => 'ERROR: 301/302 :endpoint returns a redirect. For security reasons, we don’t follow redirects. Please use the actual endpoint.',
4747
'error_misc' => 'Something went wrong. :( ',
4848
'webhook_fail' => ' webhook notification failed: Check to make sure the URL is still valid.',
49+
'webhook_channel_not_found' => ' webhook channel not found.'
4950
]
5051
];

0 commit comments

Comments
 (0)