We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
function _ajax() { return new Promise((resolve, reject) => { ... }) } /** * HTTP Error retry * * @params {Object} options: ajax params * @params {Number | undefined} limitCount: retry max count * @params {Number | undefined} providedCount: current retry count */ function _retry(options, limitCount, providedCount) { // set default value if(!limitCount) { limitCount = 3 } if(!providedCount) { providedCount = 0 } return _ajax(options) .catch(err => { // retry condition if(err.name === 'HTTPError' && providedCount < limitCount) { return new Promise(resolve => { // retry after 1 second setTimeout(() => { resolve(_retry(options, limitCount, providedCount++)) }, 1000) }) } throw err }) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: