How to catch an exception in vuex in vue2.x?

problem:
vuex encountered an exception during conversion after successfully obtaining the background data:

Uncaught (in promise) TypeError: Cannot read property "docInfo" of undefined

but how to catch such global exceptions?

made the following attempts, but could not catch the exception:

//
const errorHandler = (error, vm)=>{
  console.error("");
  console.error(vm);
  console.error(error);

}

Vue.config.errorHandler = errorHandler;
Vue.prototype.$throw = function (error) {
  return errorHandler(error, this);
};

// window error
window.onerror = (msg, url, line, col, error) => {
  console.log("window.onerror")
  return true // errorerror
}

// promise rejecttion promise
window.addEventListener("unhandledrejection", e => {
  console.log("unhandledrejection")
  return true
})


const root = document.createElement("div")
document.body.appendChild(root)
new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount(root)

errorCaptured mode has also been tried, but the exception still cannot be caught

Jun.04,2021
Menu