Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Make sure that errors in the incoming webhook url are caught.
James Cole1b1712d99895
diff --git a/app/Handlers/Events/Model/RuleHandler.php b/app/Handlers/Events/Model/RuleHandler.phpindex 872429747b..490a4ac72f 100644--- a/app/Handlers/Events/Model/RuleHandler.php+++ b/app/Handlers/Events/Model/RuleHandler.php@@ -27,7 +27,9 @@ namespace FireflyIII\Handlers\Events\Model;use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;use FireflyIII\Events\Model\Rule\RuleActionFailedOnObject;use FireflyIII\Notifications\User\RuleActionFailed;+use GuzzleHttp\Exception\ClientException;use Illuminate\Support\Facades\Notification;+use Log;/*** Class RuleHandler@@ -55,8 +57,11 @@ class RuleHandler$ruleTitle = $rule->title;$ruleLink = route('rules.edit', [$rule->id]);$params = [$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink];-- Notification::send($user, new RuleActionFailed($params));+ try {+ Notification::send($user, new RuleActionFailed($params));+ } catch(ClientException $e) {+ Log::error(sprintf('[a] Error sending notification that the rule action failed: %s', $e->getMessage()));+ }}public function ruleActionFailedOnObject(RuleActionFailedOnObject $event): void@@ -80,7 +85,10 @@ class RuleHandler$ruleTitle = $rule->title;$ruleLink = route('rules.edit', [$rule->id]);$params = [$mainMessage, $groupTitle, $groupLink, $ruleTitle, $ruleLink];-- Notification::send($user, new RuleActionFailed($params));+ try {+ Notification::send($user, new RuleActionFailed($params));+ } catch(ClientException $e) {+ Log::error(sprintf('[b] Error sending notification that the rule action failed: %s', $e->getMessage()));+ }}}diff --git a/app/Notifications/User/RuleActionFailed.php b/app/Notifications/User/RuleActionFailed.phpindex 5c704c5e1e..669d8b8e7b 100644--- a/app/Notifications/User/RuleActionFailed.php+++ b/app/Notifications/User/RuleActionFailed.php@@ -112,11 +112,11 @@ class RuleActionFailed extends Notification$slackUrl = '';}if (UrlValidator::isValidWebhookURL((string)$slackUrl)) {- app('log')->debug('Will send ruleActionFailed through Slack!');+ app('log')->debug('Will send ruleActionFailed through Slack or Discord!');return ['slack'];}- app('log')->debug('Will NOT send ruleActionFailed through Slack');+ app('log')->debug('Will NOT send ruleActionFailed through Slack or Discord');return [];}