From the Github Docs. The response of an axios request looks like

  // `data` is the response that was provided by the server
  data: {},

  // `status` is the HTTP status code from the server response
  status: 200,

  // `statusText` is the HTTP status message from the server response
  statusText: 'OK',

  // `headers` the headers that the server responded with
  // All header names are lower cased
  headers: {},

  // `config` is the config that was provided to `axios` for the request
  config: {},

  // `request` is the request that generated this response
  // It is the last ClientRequest instance in node.js (in redirects)
  // and an XMLHttpRequest instance the browser
  request: {}

So essentially catch(error => ) is actually just catch(response => )

and so you can log and you should be able to see your response message.

When you log console.log(error), what you see is the string returned by the toString method on the error object.

According to the error handling section on the same docs, you can have the catch the error response like, data)
        .then((response) => {

        .catch((error)=> {
            if (error.response) {
              // The request was made and the server responded with a status code
              // that falls out of the range of 2xx
            } else if (error.request) {
              // The request was made but no response was received
              // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
              // http.ClientRequest in node.js
            } else {
              // Something happened in setting up the request that triggered an Error
              console.log('Error', error.message);

Related Query

More Query from same tag