From ccca5e0e21fd1225ec1472a85547ff1436e0b506 Mon Sep 17 00:00:00 2001 From: Yasu Flores Date: Tue, 15 Oct 2019 18:20:56 -0700 Subject: [PATCH] Add error toJSON example (#2466) --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 533f2c3696..ad94aabed8 100755 --- a/README.md +++ b/README.md @@ -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*.