mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
24 lines
840 B
PHP
24 lines
840 B
PHP
<?php
|
|
|
|
class Slack
|
|
{
|
|
public static function sendErrorIfProd($e, $alert = true)
|
|
{
|
|
if ($e instanceof Throwable) {
|
|
$e = Debug::exceptionToString($e);
|
|
}
|
|
|
|
$slackErrorNotificationUrl = Config::get(Config::SLACK_ERROR_NOTIFICATION_URL);
|
|
if ($slackErrorNotificationUrl) {
|
|
Curl::post($slackErrorNotificationUrl, ['text' => ($alert ? '<!channel> ' : '') . Request::getRelativeUri() . "\n" . $e], ['json_data' => true]);
|
|
}
|
|
}
|
|
|
|
public static function slackGrin()
|
|
{
|
|
$slackErrorNotificationUrl = Config::get(Config::SLACK_ERROR_NOTIFICATION_URL);
|
|
if ($slackErrorNotificationUrl) {
|
|
Curl::post($slackErrorNotificationUrl, ['text' => '<@U1R0URBC1> Failed to parse html on ' . Request::getRelativeUri()], ['json_data' => true]);
|
|
}
|
|
}
|
|
}
|