PanJiaChen/vue-admin-template · error

error.message

Error message

error.message

What it means

Network-layer error handler in the axios response interceptor: fires when the request fails before a valid HTTP response is produced (timeout, DNS, CORS, connection refused) or axios itself rejects, and displays axios's error.message to the user.

Source

Thrown at src/utils/request.js:77

        MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
          confirmButtonText: 'Re-Login',
          cancelButtonText: 'Cancel',
          type: 'warning'
        }).then(() => {
          store.dispatch('user/resetToken').then(() => {
            location.reload()
          })
        })
      }
      return Promise.reject(new Error(res.message || 'Error'))
    } else {
      return res
    }
  },
  error => {
    console.log('err' + error) // for debug
    Message({
      message: error.message,
      type: 'error',
      duration: 5 * 1000
    })
    return Promise.reject(error)
  }
)

export default service

View on GitHub (pinned to 4c18a3f47b)

Solutions

  1. Check the browser network tab to identify the underlying failure (status 0, timeout, ERR_CONNECTION)
  2. Verify the API base URL, proxy configuration, and CORS settings on the server
  3. Add a request timeout and friendly mapping of common network error.message strings
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/utils/request.js:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of PanJiaChen/vue-admin-template@4c18a3f47b (2026-09-02). Data as JSON: /api/errors/bc7c8c5469a15c35. Report an issue: GitHub.