dont alert on 404s

This commit is contained in:
Alex Grintsvayg 2016-09-05 18:37:16 -04:00
parent 64bd42c61a
commit 84c4a9ed19
2 changed files with 3 additions and 3 deletions

View file

@ -39,7 +39,7 @@ class NavActions extends Actions
{
$uri = Request::getRelativeUri();
Controller::queueToRunAfterResponse(function() use($uri) {
Slack::sendErrorIfProd('404 for url ' . $uri);
Slack::sendErrorIfProd('404 for url ' . $uri, false);
});
Response::setStatus(404);
return ['page/404'];

View file

@ -3,7 +3,7 @@
class Slack
{
public static function sendErrorIfProd($e)
public static function sendErrorIfProd($e, $alert = true)
{
if ($e instanceof Throwable)
{
@ -13,7 +13,7 @@ class Slack
$slackErrorNotificationUrl = Config::get('slack_error_notification_url');
if ($slackErrorNotificationUrl)
{
Curl::post($slackErrorNotificationUrl, ['text' => '<!channel> ' . Request::getRelativeUri() . "\n" . $e], ['json_data' => true]);
Curl::post($slackErrorNotificationUrl, ['text' => ($alert ? '<!channel> ' : '') . Request::getRelativeUri() . "\n" . $e], ['json_data' => true]);
}
}
}