From 9155e737b20f2a1a1098ac814c1338b7ab39562d Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Thu, 15 May 2025 11:08:27 -0400 Subject: [PATCH] Capture broadcast error in Sentry --- app/models/account/sync_complete_event.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/account/sync_complete_event.rb b/app/models/account/sync_complete_event.rb index 129e64a3..32315375 100644 --- a/app/models/account/sync_complete_event.rb +++ b/app/models/account/sync_complete_event.rb @@ -1,6 +1,8 @@ class Account::SyncCompleteEvent attr_reader :account + Error = Class.new(StandardError) + def initialize(account) @account = account end @@ -38,7 +40,12 @@ class Account::SyncCompleteEvent # The sidebar will show the account in both its classification tab and the "all" tab, # so we need to broadcast to both. def account_group_ids - return [] unless account_group.present? + unless account_group.present? + error = Error.new("Account #{account.id} is not part of an account group") + Rails.logger.warn(error.message) + Sentry.capture_exception(error, level: :warning) + return [] + end id = account_group.id [ id, "#{account_group.classification}_#{id}" ]