-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimistic Error Handling Got TypeError Not NetworkError #989
Comments
This issue only appear on Chrome, on Firefox the code ran successfully without any issue. |
Actually no, it doesn't work either on Firefox. |
Each browser's export function isNetworkError(error: Error): boolean {
// From p-retry, but it's not exported.
// @see https://github.com/danmichaelo/p-retry/blob/6a0e880bb9f15c31a49886775bc5431899f743c5/index.js#L3
const networkErrorMsgs = new Set([
'Failed to fetch', // Chrome
'NetworkError when attempting to fetch resource.', // Firefox
'The Internet connection appears to be offline.', // Safari
'Network request failed', // `cross-fetch`
'fetch failed', // Undici (Node.js)
]);
return networkErrorMsgs.has(error.message);
} |
Hi @bradjones1, thanks for the reply. Actually I have solved the problem similar with yours. I think would be good if this NetworkError handled on the low level instead of the application layer. |
When implement the optimistic strategies for OrbitJS offline I always got error "TypeError" instead of "NetworkError" inside the RequestStrategy updateFail action block.
Here is my coordinator code (see my comment inside the RequestStrategy updateFail block) :
I am using OrbitJS V0.17 and I am following the sample implementation from here https://github.com/orbitjs/todomvc-ember-orbit#scenario-4-memory--backup--remote. Anyone knows why this happened ?
The text was updated successfully, but these errors were encountered: