mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 21:45:23 +02:00
Capture broadcast error in Sentry
This commit is contained in:
parent
a565343102
commit
9155e737b2
1 changed files with 8 additions and 1 deletions
|
@ -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}" ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue