Skip to content

Instantly share code, notes, and snippets.

@rafaelqueiroz88
Created November 28, 2021 21:13
Show Gist options
  • Save rafaelqueiroz88/94f50923b117bb37b2e2831d5effc90c to your computer and use it in GitHub Desktop.
Save rafaelqueiroz88/94f50923b117bb37b2e2831d5effc90c to your computer and use it in GitHub Desktop.
Get errors or status from non 200 code
.then(r => {
console.log(r) // { data: {content: here} }
})
.catch(err => {
console.log(err.response.data.message) // { error: message }
console.log(err.response.status) // status code (as integer)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment