[Vuejs]-Hide 503 error in Vue 2.0 app with Axios HTTP requests

0đź‘Ť

âś…

I don’t know axios specfically, so my answer could not be the best one.

Looking at the docs you linked, it seems that you could write this to avoid the 503 status code to throw an error:

axios.get(“/api?param=myparam”,
          {
           validateStatus: status => status != 503
          }
)

As a more aggressive alternative, have you tried wrapping your Promise.all in a try..catch block?
Like this:

try {
  Promise.all(promiseArray)
} catch(err) {
  // Here you can manage your error, it's in the "err" variable
  // I suggest to handle this error in some way, as there could not only be an 503 error
} 

Leave a comment