1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-25 08:09:38 +02:00

Add context to plaid sync errors

This commit is contained in:
Zach Gollwitzer 2024-12-02 12:04:54 -05:00
parent d73e7eacce
commit 9ec94cd1fa
3 changed files with 21 additions and 4 deletions

View file

@ -9,7 +9,8 @@ class Sync < ApplicationRecord
start!
begin
syncable.sync_data(start_date: start_date)
data = syncable.sync_data(start_date: start_date)
update!(data: data) if data
complete!
rescue StandardError => error
fail! error
@ -29,7 +30,10 @@ class Sync < ApplicationRecord
end
def fail!(error)
Sentry.capture_exception(error)
Sentry.capture_exception(error) do |scope|
scope.set_context("sync", { id: id })
end
update! status: :failed, error: error.message, last_ran_at: Time.current
end
end