mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
add try/catch around notification failing for inactive slack hooks
This commit is contained in:
parent
c5afc66d46
commit
b635822a85
|
@ -100,18 +100,27 @@ class CheckoutableListener
|
||||||
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
|
$notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
|
||||||
$notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
|
$notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Notification::route($this->webhookSelected(), Setting::getSettings()->webhook_endpoint)
|
Notification::route($this->webhookSelected(), Setting::getSettings()->webhook_endpoint)
|
||||||
->notify($this->getCheckoutNotification($event, $acceptance));
|
->notify($this->getCheckoutNotification($event, $acceptance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
Log::warning("ClientException caught during checkin notification: " . $e->getMessage());
|
||||||
|
return redirect()->back()->with('error', ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed: Check to make sure your URL is still valid.');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'webhook_endpoint' => Setting::getSettings()->webhook_endpoint,
|
||||||
|
'event' => $event,
|
||||||
|
]);
|
||||||
|
return redirect()->back()->with('error', ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed: Check to make sure your URL is still valid.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the user and post to webhook about the checked in checkoutable
|
* Notify the user and post to webhook about the checked in checkoutable
|
||||||
*/
|
*/
|
||||||
|
@ -187,9 +196,15 @@ class CheckoutableListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
Log::warning("Exception caught during checkin notification: " . $e->getMessage());
|
Log::warning("ClientException caught during checkin notification: " . $e->getMessage());
|
||||||
|
return redirect()->back()->with('error', ucfirst(Setting::getSettings()->webhook_selected) .' webhook notification failed: Check to make sure the URL is still valid.');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::warning("Exception caught during checkin notification: " . $e->getMessage());
|
Log::error(ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed:', [
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'webhook_endpoint' => Setting::getSettings()->webhook_endpoint,
|
||||||
|
'event' => $event,
|
||||||
|
]);
|
||||||
|
return redirect()->back()->with('error', ucfirst(Setting::getSettings()->webhook_selected) . ' webhook notification failed: Check to make sure the URL is still valid.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue