Skip to content

Commit

Permalink
Merge pull request #10 from SOFware/log-errors
Browse files Browse the repository at this point in the history
Rescue from post errors and log
  • Loading branch information
saturnflyer authored Nov 13, 2023
2 parents 6a7c3f6 + 526d3bb commit 13f7b3a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/chat_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 13f7b3a

Please sign in to comment.