Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router): Default error handler no longer rejects the navigation p…
…romise The Router currently provides the ability to configure a custom `errorHandler` for when unhandled exceptions are thrown during navigation. This allows developers to handle navigation errors separately from other errors that might be thrown and caught by the global [`ErrorHandler`](https://angular.io/api/core/ErrorHandler). The mechanism to do this would be to use a custom error handler that does not rethrow the navigation error, thereby preventing it from ever bubbling up to `ErrorHandler` at all. Since we are deprecating the `errorHandler` configuration in the Router, there needs to be a replacement for this use-case. That is, developers need a way to handle navigation errors separately from other types of errors. This commit updates the default error handler in the Router to _not_ throw an error, meaning that the navigation promise will not be rejected. Instead, the navigation promise is resolved with `false`, the same behavior as when the navigation fails to complete for any other reason. fixes #48902 BREAKING CHANGE: By default, the Router no longer rejects the navigation promise when an unhandled Error is thrown during navigation. Instead, the promise is resolved with `false`, matching the behavior of any other navigations which do not complete successfully. The default behavior previously rethrew the original error. The original error is still available in the `NavigationError` event if needed and can be handled by subscribing to the `Router.events` Observable.
- Loading branch information
Showing
4 changed files
with
46 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters