title: How can I get the status code from an HTTP error in Axios?
body: <p>This may seem stupid, but I'm trying to get the error data when a request fails in Axios.</p>
  <pre class="lang-js prettyprint-override"><code>axios
    .get('foo.example')
    .then((response) =&gt; {})
    .catch((error) =&gt; {
      console.log(error); //Logs a string: Error: Request failed with status code 404
    });
  </code></pre>
  <p>Instead of the string, is it possible to get an object with perhaps the status code and content? For example:</p>
  <pre><code>Object = {status: 404, reason: 'Not found', body: '404 Not found'}
  </code></pre>