Advertisement
dereksir

Untitled

Dec 12th, 2023 (edited)
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //..
  2.  
  3.     operation.attempt(function(currentAttempt) {
  4.         // Make an HTTP GET request to http://httpbin.io/status/500
  5.         axios.get(URL)
  6.             .then((response) => {
  7.                 // If the request is successful, resolve the Promise with the response body
  8.                 cb(null, response.data);
  9.             })
  10.             .catch((error) => {
  11.                 // If there's an error, check if retry is allowed.
  12.                 if (operation.retry(error)) {
  13.                     return;
  14.                 }
  15.  
  16.                 // If all retry attempts are exhausted, reject with the main error
  17.                 cb(operation.mainError());
  18.             });
  19.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement