const err = await axios.
get('https://httpbin.org/basic-auth/foo/bar', {
auth: {
username: 'foo',
password: 'baz' // Bad password
}
}).
catch(err => err);
err.message; // "Request failed with status code 401"
err.response.status; // 401 "Unauthorized"