angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.56k stars 3.01k forks source link

Uncaught (in promise): Transition Rejection when returning rejected promise or false value from OnBefore hook. #3755

Closed gauravmahto closed 4 years ago

gauravmahto commented 5 years ago

This is a:

My version of UI-Router is: 2.0.2

Bug Report

When returning a rejected Promise or false value from OnBefore hook, an uncaught promise error is logged into the broswer console window.

Current Behavior:

ERROR Error: Uncaught (in promise): Transition Rejection($id: 4 type: 3, message: The transition has been aborted, detail: Hook aborted transition)
    at resolvePromise (polyfills.a702cd03.js:1) [angular]
    at resolvePromise (polyfills.a702cd03.js:1) [angular]
    at /core/polyfills.a702cd03.js:1:73985 [angular]
    at Object.onInvokeTask (vendor.8d814fc0.js:1) [angular]
    at drainMicroTaskQueue (polyfills.a702cd03.js:1) [<root>]
    at ZoneTask.invokeTask (polyfills.a702cd03.js:1) [<root>]
    at n.args.(/admin/anonymous function) (https://www.localnode.com/core/polyfills.a702cd03.js:1:85412) [<root>]

Expected Behavior:

Should not produce such logs

Link to stackblitz that reproduces the issue:

https://stackblitz.com/edit/angular-ui-router-bug

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.