mirror of
https://github.com/we-promise/sure.git
synced 2026-04-24 14:34:08 +00:00
Implement error handling and logging for sparkline and series methods
- Added rescue blocks to handle exceptions in the Accounts and AccountableSparklines controllers, logging errors and rendering error partials. - Enhanced error handling in the Account::Chartable and Balance::ChartSeriesBuilder models, logging specific error messages for series generation failures. - Updated the accounts view to include a timeout for Turbo frame loading. - Added a test to ensure graceful handling of sparkline errors in the AccountsController. In reference to bug #2315
This commit is contained in:
@@ -29,5 +29,15 @@ module Account::Chartable
|
||||
Rails.cache.fetch(cache_key) do
|
||||
balance_series
|
||||
end
|
||||
rescue => e
|
||||
Rails.logger.error "Sparkline series error for account #{id}: #{e.message}"
|
||||
# Return empty series as fallback
|
||||
Series.new(
|
||||
start_date: 30.days.ago.to_date,
|
||||
end_date: Date.current,
|
||||
interval: "1 day",
|
||||
values: [],
|
||||
favorable_direction: favorable_direction
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user