{"record":{"id":"0e67c5428b209417","repo":"PanJiaChen/vue-admin-template","slug":"error-has-error","errorCode":null,"errorMessage":"error || 'Has Error'","messagePattern":"error \\|\\| 'Has Error'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/permission.js","lineNumber":41,"sourceCode":"  if (hasToken) {\n    if (to.path === '/login') {\n      // if is logged in, redirect to the home page\n      next({ path: '/' })\n      NProgress.done()\n    } else {\n      const hasGetUserInfo = store.getters.name\n      if (hasGetUserInfo) {\n        next()\n      } else {\n        try {\n          // get user info\n          await store.dispatch('user/getInfo')\n\n          next()\n        } catch (error) {\n          // remove token and go to login page to re-login\n          await store.dispatch('user/resetToken')\n          Message.error(error || 'Has Error')\n          next(`/login?redirect=${to.path}`)\n          NProgress.done()\n        }\n      }\n    }\n  } else {\n    /* has no token*/\n\n    if (whiteList.indexOf(to.path) !== -1) {\n      // in the free login whitelist, go directly\n      next()\n    } else {\n      // other pages that do not have permission to access are redirected to the login page.\n      next(`/login?redirect=${to.path}`)\n      NProgress.done()\n    }\n  }\n})","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/PanJiaChen/vue-admin-template/blob/4c18a3f47bdb417ad8a25f09910f848cb574dee2/src/permission.js#L23-L59","documentation":"Fallback message in the global router guard: shown when store.dispatch('user/getInfo') throws during navigation (empty user data, invalid/expired token, or network failure); the guard then resets the token, shows the error (or the 'Has Error' sentinel when the rejection was falsy) and redirects to /login with a redirect query.","triggerScenarios":"Thrown at src/permission.js:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-authenticate via the login page the guard redirects to","Ensure getInfo rejects with a non-empty Error so the real cause is displayed instead of the sentinel","Check backend availability and token validity if the error recurs on every navigation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c18a3f47bdb417ad8a25f09910f848cb574dee2","analyzedAt":"2026-09-02T02:49:53.558Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}