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

Do not raise on Plaid item not found exceptions for item deletions (#1646)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

This commit is contained in:
Zach Gollwitzer 2025-01-20 15:12:53 -05:00 committed by GitHub
parent abccba3947
commit 72fd177707
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -131,5 +131,7 @@ class PlaidItem < ApplicationRecord
def remove_plaid_item def remove_plaid_item
plaid_provider.remove_item(access_token) plaid_provider.remove_item(access_token)
rescue StandardError => e
Rails.logger.warn("Failed to remove Plaid item #{id}: #{e.message}")
end end
end end

View file

@ -18,4 +18,16 @@ class PlaidItemTest < ActiveSupport::TestCase
@plaid_item.destroy @plaid_item.destroy
end end
end end
test "if plaid item not found, silently continues with deletion" do
@plaid_provider = mock
PlaidItem.stubs(:plaid_provider).returns(@plaid_provider)
@plaid_provider.expects(:remove_item).with(@plaid_item.access_token).raises(Plaid::ApiError.new("Item not found"))
assert_difference "PlaidItem.count", -1 do
@plaid_item.destroy
end
end
end end