2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-23 20:40:40 +03:00

Fixing doc on accessing response with then/catch

Docs were suggesting that accessing the response with `catch` was the same as accessing it with `then`. Split the two cases and point to the Handling Errors section. Also mention the case where a rejection callback is specified as second parameter of `then`.
This commit is contained in:
Axel Bocciarelli
2016-08-09 13:24:24 +10:00
committed by GitHub
parent 8abe0d4007
commit 1525e8771b
+3 -1
View File
@@ -322,7 +322,7 @@ The response for a request contains the following information.
} }
``` ```
When using `then` or `catch`, you will receive the response as follows: When using `then`, you will receive the response as follows:
```js ```js
axios.get('/user/12345') axios.get('/user/12345')
@@ -335,6 +335,8 @@ axios.get('/user/12345')
}); });
``` ```
When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
## Config Defaults ## Config Defaults
You can specify config defaults that will be applied to every request. You can specify config defaults that will be applied to every request.