From 405d50ecf494864b5dc428775aaa2ec347393726 Mon Sep 17 00:00:00 2001 From: Yasu Flores Date: Mon, 14 Oct 2019 16:44:30 -0700 Subject: [PATCH] Add error toJSON example --- 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*.