mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02: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:
parent
3cc88f3e98
commit
6f67827f14
9 changed files with 113 additions and 8 deletions
|
@ -6,13 +6,32 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
|
|||
@account = accounts(:depository)
|
||||
end
|
||||
|
||||
test "new" do
|
||||
get new_account_path
|
||||
assert_response :ok
|
||||
test "should get index" do
|
||||
get accounts_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "can sync an account" do
|
||||
post sync_account_path(@account)
|
||||
assert_redirected_to account_path(@account)
|
||||
test "should sync account" do
|
||||
post sync_account_url(@account)
|
||||
assert_redirected_to account_url(@account)
|
||||
end
|
||||
|
||||
test "should get chart" do
|
||||
get chart_account_url(@account)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get sparkline" do
|
||||
get sparkline_account_url(@account)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should handle sparkline errors gracefully" do
|
||||
# Mock an error in the sparkline_series method
|
||||
@account.stubs(:sparkline_series).raises(StandardError.new("Test error"))
|
||||
|
||||
get sparkline_account_url(@account)
|
||||
assert_response :success
|
||||
assert_match /Error/, response.body
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue