title: How do I get the full error message from my Node and Express server on the client side?
body: <p>I have an express route that returns a 400 status and an error message. I want to alert the full error message on the client-side, but the alert only says "Object object" when I alert it. I inspected that object and I don't see the full error message that I see logged to my terminal from the server. </p>
  
  <p>On the server the error message says, "djhbf is not defined" because I typed in some random characters to throw an error message. On the client-side, the object has some properties, but none of them contain the error message "djhbf is not defined". The closest thing to an error message is, "status-text: bad request". How do I retrieve the actual error message "djhbf is not defined" on the client-side?</p>
  
  <p>Here is my server.js code which sends the error message in its catch block of a promise: </p>
  
  <pre><code>app.post('/sendEmails', function(req, res, next) {
    axios.get(FEED_URL)
      .then(data =&gt; {
        let jobs = data.data.jobs;
        fetchClients(jobs, 'email').then(() =&gt; {
          res.sendStatus(200);
        })
        .catch((err) =&gt; {
          console.log(err);
          res.status(400).json(err);
        })
      })
      .catch(error =&gt; {
        console.log(error);
      });
  });
  </code></pre>
  
  <p>Here is the client-side code which alerts the error:</p>
  
  <pre><code>sendEmails() {
      axios.post("/sendEmails")
        .then(res =&gt; {
          this.setState({
            emailsSent: true,
            smsSent: false
          });
        })
        .catch((err) =&gt; {
          console.log(err);
          alert(err);
        });
    }
  </code></pre>