title: How to retry 5xx requests using axios
body: <p>I would like to retry 5xx requests using axios. I have my main request in the middle of a try catch block. I am using the axios-retry library to auto retry 3 times.</p>
  
  <p>The url i am using will deliberately throw a 503. However the request is not being retried, instead it is being caught in my catch block.</p>
  
  <pre><code>axiosRetry(axios, {
    retries: 3
  });
  
  let result;
  
  const url = "https://httpstat.us/503";
  const requestOptions = {
    url,
    method: "get",
    headers: {
    },
    data: {},
  };
  
  
  try {
  
    result = await axios(requestOptions);
  
  } catch (err) {
    throw new Error("Failed to retry")
  }
  
  }
  return result;
  </code></pre>