title: How to get exception message in Axios from a Spring boot backend
body: <p>I use a spring boot back with react front. Api calls are with axios. Now in Spring Controller I handle exceptions and throw another one for React to extract a message from (I really need this message). But all i get is &quot;Request failed with status code 500&quot;. How can I get this message?
  My controller:</p>
  <pre><code>@DeleteMapping(&quot;/{id}&quot;)
      public ResponseEntity&lt;?&gt; delete(@PathVariable(&quot;id&quot;) Integer id) throws RuntimeException {
          log.info(&quot;Request for delete settings {}&quot;, id);
          try{
              Settings settings = settingsService.findById(id);
          settingsService.delete(settings.getId());
          log.info(&quot;SUCCESS: {} deleted.&quot;, settings.getId());
          return new ResponseEntity&lt;&gt;(settings.getId() + &quot; deleted successfully.&quot;, HttpStatus.NO_CONTENT);
          } catch (RuntimeException e) {
              System.out.println(&quot;CAUSE Controller: &quot;+e.getCause().getMessage());
              throw new RuntimeException(&quot;Error during deletion: &quot; + e.getCause().getMessage());
          }
      }
  </code></pre>
  <p>SettingsApiService.js:</p>
  <pre><code>delete(id) {
          return axios.delete(`${BASE_URL}/${id}`, ApiService.getAuthHeader());
      }
  </code></pre>
  <p>Now I have a &quot;Table&quot; component which i reuse a lot. And send the deletion method as a prop from every respecting component.
  This one is from the Settings component</p>
  <pre><code> &lt;Table
                      ref='table'
                      getTr={this.getTr()}
                      getUrl={this.getUrl(idType)}
                      columns={this.getColumns()}
                      updateSelectedItem={this.updateSelectedItem}
                      deleteItem={this.deleteItem}
                      isSettings={true}
                      showDelete={showDelete}
                      toggleShowDelete={this.toggleShowDelete}
                  /&gt;
  </code></pre>
  <p>And the Deleteitem method in Settings I send is:</p>
  <pre><code>deleteItem = async () =&gt; {
          await SettingsApiService.delete(this.state.selectedId);
      };
  </code></pre>
  <p>And in Table component I delete with a button like this:</p>
  <pre><code>&lt;Button
                              variant='primary'
                              onClick={() =&gt; {
                                  globalProps
                                      .deleteItem()
                                      .then((res) =&gt; {
                                          console.log(res);
                                          table.draw();
                                      })
                                      .catch((e) =&gt; {
                                          console.log(e);
                                          this.setState({ error: e.message });
                                          this.setState({ showModalBatch: true });
                                      });
                                  this.props.toggleShowDelete();
                              }}
                          &gt;
                              Delete
                          &lt;/Button&gt;
  </code></pre>
  <p>I want the e.message to be the one I threw in Controller. How do I do this?</p>