mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-18 16:00:34 -05:00
Compare commits
3 Commits
react-quer
...
claude/deb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5373ca9012 | ||
|
|
42ce174fc9 | ||
|
|
512049376f |
@@ -85,8 +85,24 @@ export function CreateAccountModal({
|
||||
|
||||
try {
|
||||
const results = await send('simplefin-accounts');
|
||||
if (results.error_code === 'INVALID_ACCESS_TOKEN') {
|
||||
setLoadingSimpleFinAccounts(false);
|
||||
dispatch(
|
||||
pushModal({
|
||||
modal: {
|
||||
name: 'simplefin-init',
|
||||
options: {
|
||||
onSuccess: () => setIsSimpleFinSetupComplete(true),
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (results.error_code) {
|
||||
throw new Error(results.reason);
|
||||
throw new Error(
|
||||
results.reason || `SimpleFIN error: ${results.error_code}`,
|
||||
);
|
||||
}
|
||||
|
||||
const newAccounts = [];
|
||||
@@ -127,12 +143,12 @@ export function CreateAccountModal({
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
dispatch(
|
||||
pushModal({
|
||||
modal: {
|
||||
name: 'simplefin-init',
|
||||
options: {
|
||||
onSuccess: () => setIsSimpleFinSetupComplete(true),
|
||||
},
|
||||
addNotification({
|
||||
notification: {
|
||||
type: 'error',
|
||||
title: t('Error when trying to contact SimpleFIN'),
|
||||
message: (err as Error).message || t('An unknown error occurred.'),
|
||||
timeout: 10000,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -746,8 +746,20 @@ async function simpleFinAccounts() {
|
||||
},
|
||||
60000,
|
||||
);
|
||||
} catch {
|
||||
return { error_code: 'TIMED_OUT' };
|
||||
} catch (error) {
|
||||
if (error instanceof PostError && error.reason === 'network-failure') {
|
||||
return {
|
||||
error_code: 'TIMED_OUT',
|
||||
reason: 'Request timed out or the sync server could not be reached.',
|
||||
};
|
||||
}
|
||||
return {
|
||||
error_code: 'REQUEST_FAILED',
|
||||
reason:
|
||||
error instanceof PostError
|
||||
? `Sync server error: ${error.reason}`
|
||||
: 'An unexpected error occurred.',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,11 @@ app.post(
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
serverDown(e, res);
|
||||
if (e.message === 'Forbidden') {
|
||||
invalidToken(res);
|
||||
} else {
|
||||
serverDown(e, res);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}),
|
||||
@@ -279,13 +283,33 @@ function invalidToken(res) {
|
||||
|
||||
function serverDown(e, res) {
|
||||
console.log(e);
|
||||
|
||||
let detail = 'There was an error communicating with SimpleFIN.';
|
||||
|
||||
if (e.message === 'Forbidden') {
|
||||
detail =
|
||||
'SimpleFIN rejected the request (403 Forbidden). Your access key may be expired.';
|
||||
} else if (e.message === 'Invalid access key') {
|
||||
detail =
|
||||
'The SimpleFIN access key format is invalid. Please reset and re-enter your credentials.';
|
||||
} else if (e instanceof SyntaxError) {
|
||||
detail =
|
||||
'SimpleFIN returned an invalid response. The service may be temporarily unavailable.';
|
||||
} else if (
|
||||
e.cause?.code === 'ENOTFOUND' ||
|
||||
e.cause?.code === 'ECONNREFUSED' ||
|
||||
e.message?.includes('fetch failed')
|
||||
) {
|
||||
detail = 'Could not connect to SimpleFIN server.';
|
||||
}
|
||||
|
||||
res.send({
|
||||
status: 'ok',
|
||||
data: {
|
||||
error_type: 'SERVER_DOWN',
|
||||
error_code: 'SERVER_DOWN',
|
||||
status: 'rejected',
|
||||
reason: 'There was an error communicating with SimpleFIN.',
|
||||
reason: detail,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
6
upcoming-release-notes/7192.md
Normal file
6
upcoming-release-notes/7192.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Enhancements
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
Improve SimpleFIN error handling with specific notifications and context-aware messages for users.
|
||||
Reference in New Issue
Block a user