mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 21:29:38 +02:00
Improve Security Price Loading with Robust Error Handling
- Add error handling for individual security price loading - Log detailed error information for problematic securities - Prevent single security errors from halting entire price loading process - Enhance logging with more specific security identification details
This commit is contained in:
parent
50e5ffb257
commit
4c158934d0
1 changed files with 18 additions and 11 deletions
|
@ -121,7 +121,8 @@ class Account::HoldingCalculator
|
||||||
Rails.logger.info "[HoldingCalculator] Preloading #{securities.size} securities for account #{account.id}"
|
Rails.logger.info "[HoldingCalculator] Preloading #{securities.size} securities for account #{account.id}"
|
||||||
|
|
||||||
securities.each do |security|
|
securities.each do |security|
|
||||||
Rails.logger.info "[HoldingCalculator] Loading prices for security #{security.id} (#{security.symbol})"
|
begin
|
||||||
|
Rails.logger.info "[HoldingCalculator] Loading security: ID=#{security.id} Ticker=#{security.ticker}"
|
||||||
|
|
||||||
prices = Security::Price.find_prices(
|
prices = Security::Price.find_prices(
|
||||||
security: security,
|
security: security,
|
||||||
|
@ -135,6 +136,12 @@ class Account::HoldingCalculator
|
||||||
security: security,
|
security: security,
|
||||||
prices: prices
|
prices: prices
|
||||||
}
|
}
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error "[HoldingCalculator] Error processing security #{security.id}: #{e.message}"
|
||||||
|
Rails.logger.error "[HoldingCalculator] Security details: #{security.attributes}"
|
||||||
|
Rails.logger.error e.backtrace.join("\n")
|
||||||
|
next # Skip this security and continue with others
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue