title: How can I RETURN Axios error to client? (not only logging)
body: <p>I know this has been asked many times but what I am facing is a really annoying problem.</p>
  <p>I have my server which returns error string with status code 500. When i use axios and catch the error, i can log it easily, but when i return it, i can try everything but its gives me undefined, or it doesn't append anything.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export const submitCheckout = async (betImport, ticket_id, token) =&gt; {
    const res = await axios({
      method: "post",
      url: rootUrl + "bets/checkout/" + ticket_id,
      headers: {
        "x-auth-token": token,
      },
      data: {
        betImport,
      },
    }).catch(({ response }) =&gt; {
      console.log(response.status) //this works
      return response;
    });
    return res.data;
  };
  
  //HERE I CALL THE FUNCTION
  
  const res = await submitCheckout(sum, ticket_id, token);
    //here i can access only the body of the error, even if i try to append something to it. 
      if (res.ticket_id) {
        emptyTicket();
        setmodal({
          show: true,
          title: "SUCCESS",
          subtitle: "BET PLACED",
          maxwin: `${res.maxWin}`,
          ticketId: `${res.ticket_id}`,
          account_sum: `${res.account_sum}`,
        });
        ModifyAccountUser(user, res.account_sum);
      } else {
        setmodal({
          title: "ERROR",
          show: true,
          status: `${res.status}`,
          error: `${res}`,
        });
        if (res.toString().includes("Token")) history.push("/login");
      }
      
      //WHAT I WANT TO DO
     export const submitCheckout = async (betImport, ticket_id, token) =&gt; {
    const res = await axios({
      method: "post",
      url: rootUrl + "bets/checkout/" + ticket_id,
      headers: {
        "x-auth-token": token,
      },
      data: {
        betImport,
      },
    }).catch(({ response }) =&gt; {
      return {...response, response.status}; //this returns the body only, 
      return {res: response, status: response.status}; //this crashes,
      return response + "-"+ response.status}; //this was my desperation attack and failed as well
    });
    return res.data;
  };
   
      </code></pre>
  </div>
  </div>
  </p>