How does the Vue-router navigation guard implement an error callback?

because lazy loading is used in the project, the hash code of the modified file will change after each re-build, causing the route to jump to the modified page will report the page file 404. So when the navigation guard executes next (), call back if an error occurs, refresh the page again, and update the hash code to the latest can solve the problem.

looked up the Vue-router document and found that there are two guard methods, next (error) and router.onError (callback).
but I added this code directly to the code, and it didn"t work.

how is the guard method of this Vue-router error callback used?

//
router.beforeEach((to, from, next) => {
  next(error);
})

router.onError((callback)=>{
    console.log(callback)
});
Mar.17,2021

router.onError (error = > {.}); write in this way to solve

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4db72-44f66.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4db72-44f66.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?