javascript - How can I get the status code from an HTTP error in Axios?

preview_player
Показать описание
#short
#javascript
#axios
This may seem stupid, but I'm trying to get the error data when a request fails in Axios.
axios
.then((response) = {})
.catch((error) = {
});

Instead of the string, is it possible to get an object with perhaps the status code and content? For example:
Object = {status: 404, reason: 'Not found', body: '404 Not found'}
Рекомендации по теме