mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-21 15:36:50 -05:00
Compare commits
3 Commits
js-proxy
...
claude/deb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5373ca9012 | ||
|
|
42ce174fc9 | ||
|
|
512049376f |
@@ -85,8 +85,24 @@ export function CreateAccountModal({
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await send('simplefin-accounts');
|
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) {
|
if (results.error_code) {
|
||||||
throw new Error(results.reason);
|
throw new Error(
|
||||||
|
results.reason || `SimpleFIN error: ${results.error_code}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const newAccounts = [];
|
const newAccounts = [];
|
||||||
@@ -127,12 +143,12 @@ export function CreateAccountModal({
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
dispatch(
|
dispatch(
|
||||||
pushModal({
|
addNotification({
|
||||||
modal: {
|
notification: {
|
||||||
name: 'simplefin-init',
|
type: 'error',
|
||||||
options: {
|
title: t('Error when trying to contact SimpleFIN'),
|
||||||
onSuccess: () => setIsSimpleFinSetupComplete(true),
|
message: (err as Error).message || t('An unknown error occurred.'),
|
||||||
},
|
timeout: 10000,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -746,8 +746,20 @@ async function simpleFinAccounts() {
|
|||||||
},
|
},
|
||||||
60000,
|
60000,
|
||||||
);
|
);
|
||||||
} catch {
|
} catch (error) {
|
||||||
return { error_code: 'TIMED_OUT' };
|
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) {
|
} catch (e) {
|
||||||
serverDown(e, res);
|
if (e.message === 'Forbidden') {
|
||||||
|
invalidToken(res);
|
||||||
|
} else {
|
||||||
|
serverDown(e, res);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -279,13 +283,33 @@ function invalidToken(res) {
|
|||||||
|
|
||||||
function serverDown(e, res) {
|
function serverDown(e, res) {
|
||||||
console.log(e);
|
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({
|
res.send({
|
||||||
status: 'ok',
|
status: 'ok',
|
||||||
data: {
|
data: {
|
||||||
error_type: 'SERVER_DOWN',
|
error_type: 'SERVER_DOWN',
|
||||||
error_code: 'SERVER_DOWN',
|
error_code: 'SERVER_DOWN',
|
||||||
status: 'rejected',
|
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