Vue router middleware11/20/2023 push() event before the Promise is resolved, it could also throw this error. For example, if you call this.$router.push() in a component and then that component gets destroyed while the route-change is in-progress, it is reasonable that you could see an error like this.Īs an extension of this problem, if a route-change occurs and the resultant component tries to read data from the. In my application where I saw this, it was hard to debug, but I can see the nature of the error has something to do with Vue components unloading and loading as the route changes. Secondary to the error swallowing, is the fact that the error is even thrown to begin with. In my two examples, you can see the error will pass through the catch blocks. This means it is paramount to not swallow the error, which means you need to catch it somewhere. That is to say there is no block of code that catches the error, so your app cannot do anything in response to the error. `) Īt the moment, I prefer against the async/await technique here because of its execution-blocking nature, but the key observation you should make is that the "uncaught in promise" error itself is a known issue in JavaScript often referred to as "a promise being swallowed", and it's caused by a Promise being rejected but that "error" is swallowed because it isn't properly caught. If(localStorage.page_access.indexOf('1') != -1 & localStorage.page_access != null). If the page is refreshed or the user navigates away to other pages, it does not appear. ![]() The other strange thing is that this error only ever appears the once, and that's when the user first logs in. If the user does not have page_access 1, it then routes to /holidays. I think the issue is being caused by the re-reoute. I'm facing a really strange issue where if a user with restricted permissions tries logging into my web app, they see the following error:īut this doesn't happen with users who have max permissions.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |