PanJiaChen/vue-admin-template · error
res.message || 'Error'
Error message
res.message || 'Error'
What it means
Generic error fallback shown in the axios response interceptor when the backend returns a custom business code other than 20000 and the response body carries no 'message' field; 'Error' is a sentinel placeholder for a missing server-side error description.
Source
Thrown at src/utils/request.js:51
// response interceptor
service.interceptors.response.use(
/**
* If you want to get http information such as headers or status
* Please return response => response
*/
/**
* Determine the request status by custom code
* Here is just an example
* You can also judge the status by HTTP Status Code
*/
response => {
const res = response.data
// if the custom code is not 20000, it is judged as an error.
if (res.code !== 20000) {
Message({
message: res.message || 'Error',
type: 'error',
duration: 5 * 1000
})
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
// to re-login
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'))View on GitHub (pinned to 4c18a3f47b)
Solutions
- Ensure the backend always returns a descriptive 'message' field alongside non-20000 business codes
- Inspect the network response payload to identify the actual business error code and its cause
- Handle specific business codes explicitly before falling back to the generic message
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/utils/request.js:51 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/01cbb88a252674c2.
Report an issue: GitHub.