title: How to access try catch error in Javascript through api request?
body: <p>My nodejs api sends</p>
  <pre><code>res.status(401).json({ info: 'task cannot be done' }) 
  </code></pre>
  <p>as an error and I try to catch it on the client side via</p>
  <pre><code>try {
        const resp = await axios.get('https://localhost:3000/getinfo')
        console.log('resp!!!', resp)
      } catch (error) {
        console.log('error' , error )
      }
  </code></pre>
  <p>Although on my network tab I can see the message coming in JSON format I am not sure how to extract data from error.</p>
  <p>How can I access <code>info</code> which is sent from the server side.</p>