Created
November 28, 2021 21:13
-
-
Save rafaelqueiroz88/94f50923b117bb37b2e2831d5effc90c to your computer and use it in GitHub Desktop.
Get errors or status from non 200 code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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