2021-10-17 10:36:14 +02:00
export const ALREADY _CLAIMED = 'once the invite reward has been claimed the referrer cannot be changed' ;
2021-11-03 20:47:19 +01:00
export const REFERRER _NOT _FOUND = 'A odysee account could not be found for the referrer you provided.' ;
2022-04-04 07:51:45 +02:00
export const PUBLISH _TIMEOUT _BUT _LIKELY _SUCCESSFUL = 'There was a network error, but the publish may have been completed. Wait a few minutes, then check your Uploads or Wallet page to confirm.' ;
2022-06-01 10:58:09 +02:00
export const SDK _FETCH _TIMEOUT = 'Your action timed out, but may have been completed.' ;
Add a timeout on SDK calls to allow specific error messages.
## Issue 1263
Previously, we tried to inform the user that when an SDK call such as `support_create` and `publish` fails (specifically, timed out), the operation could be successful -- please check the transactions later.
However, we only covered the case of `fetch` actually getting a response that indicated a timeout, e.g. "status = 524". For our SDK case, the timeout scenario is an error that goes into the `catch` block. In the `catch` block, we can't differentiate whether it is a timeout because it only returns a generic "failed to fetch" message.
## New Approach
Since `fetch` does not support a timeout value, the usual solution is to wrap it with a `setTimeout`. This already exists in our code as `fetchWithTimeout` (yay).
By setting a timeout that is lower than the browser's default and also lower than the SDK operation (90s for most commands, 5m for `publish`), we would now have a way to detect a timeout and inform the user.
Firefox's 90s seems to be the lowest common denominator ... so 60s was chosen as the default (added some buffer).
For the case of 'publish', it is actually called in the backend, so wrap the xhr call with a timeout as well.
2022-04-30 07:27:43 +02:00
export const FETCH _TIMEOUT = 'promise timeout' ;