Skip to content

Commit

Permalink
Adding documentation for error.request
Browse files Browse the repository at this point in the history
  • Loading branch information
rubennorte committed Apr 8, 2017
1 parent 22ce6db commit 1e76ea3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -469,11 +469,16 @@ instance.interceptors.request.use(function () {/*...*/});
axios.get('/user/12345')
.catch(function (error) {
if (error.response) {
// The request was made, but the server responded with a status code
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
Expand Down

0 comments on commit 1e76ea3

Please sign in to comment.