title: How to show server (Java) Exception message in React.js
body: <p>I am not able to see the message (in React.js catch block) set while throwing Exception (by server in Java).</p>
  
  <p><strong>Situation:</strong> User wants to perform some action (via myService), some verification w.r.t action can be done only on back-end, if that fails how to show the user what was the reason of failure?</p>
  
  <p>Service (Java):</p>
  
  <pre><code>@GetMapping(path = {/*Servive_path*/}, produces = APPLICATION_JSON_VALUE)
  public MyClass myService(@RequestParam String param) {
      throw new RuntimeException("This is error message");
  }
  </code></pre>
  
  <p>Action (React.js):</p>
  
  <pre><code>const myServive = (param) =&gt; {
    return async (dispatch, getState) =&gt; {
      return request({
        url: ENDPOINTS.MY_SERVICE,
        method: methods.GET,
        params: { param }
      })
        .then(res =&gt; {
          dispatch(saveResult(res));
          dispatch(
            notify({
              title: "Successful",
              message: "It was successfully.",
              status: 200,
              dismissAfter: CONFIG.NOTIFICATION_TIMEOUT
            })
          );
        })
        .catch(err =&gt; {
          console.log("err.data: ", err.data); //Output-&gt; err.data: 
          console.log("err.message: ", err.message); //Output-&gt; err.message: undefined
          dispatch(
            notify({
              title: "Some error occured",
              message: **//Want to set the error message**,
              status: "error",
              dismissAfter: CONFIG.NOTIFICATION_TIMEOUT
            })
          );
        });
    };
  };
  </code></pre>
  
  <p>Want to show the exception message by setting value in massage in catch block of action.</p>
  
  <p>Output</p>
  
  <pre><code>err.data: ""
  err.message: undefined
  </code></pre>
  
  <p>Also,</p>
  
  <pre><code>err.status: 500
  err.request.response: ""
  err.request.responseText: ""
  err.request.responseType: ""
  err.request.status: 500
  err.request.statusText: ""
  </code></pre>
  
  <p>Please help.</p>