From 526d3bb8592b7293f5b8b9198edd9a52a453d35f Mon Sep 17 00:00:00 2001 From: Jim Gay Date: Tue, 6 Jun 2023 15:28:00 -0400 Subject: [PATCH] Rescue from post errors and log --- lib/chat_notifier.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/chat_notifier.rb b/lib/chat_notifier.rb index 0faf4f8..5e181e7 100644 --- a/lib/chat_notifier.rb +++ b/lib/chat_notifier.rb @@ -12,6 +12,10 @@ module ChatNotifier DebugSummary = Data.define(:failed_examples) class << self + require "logger" + @logger = Logger.new($stdout) + attr_accessor :logger + def app if defined?(::Rails) Rails.application.class.module_parent @@ -57,7 +61,11 @@ def call(summary:) ) chatter.each do |box| - box.conditional_post(messenger) + begin + box.conditional_post(messenger) + rescue => exception + logger.error("ChatNotifier: #{box.webhook_url} #{exception.class}: #{exception.message}") + end end end end