2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

Add error toJSON example (#2466)

This commit is contained in:
Yasu Flores
2019-10-15 18:20:56 -07:00
committed by Felipe Martins
parent 19969b4fbd
commit ccca5e0e21
+9
View File
@@ -565,6 +565,15 @@ axios.get('/user/12345', {
})
```
Using `toJSON` you get an object with more information about the HTTP error.
```js
axios.get('/user/12345')
.catch(function (error) {
console.log(error.toJSON());
});
```
## Cancellation
You can cancel a request using a *cancel token*.