-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle Angular navigation errors #24517
Handle Angular navigation errors #24517
Conversation
withNavigationErrorHandler((e: NavigationError) => { | ||
const router = inject(Router); | ||
if (e.error.status === 403) { | ||
router.navigate(['/accessdenied']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also says the httpInterceptorProviders
import can be shorted to:
import { httpInterceptorProviders } from './core/interceptor';
CI tests seem to be failing because import {
RouterFeatures,
TitleStrategy,
provideRouter,
withComponentInputBinding,
withDebugTracing,
withNavigationErrorHandler, NavigationError, Router
} from '@angular/router'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dccf42d
to
ef9d2a4
Compare
Totally forgot the imports, sorry about that |
ef9d2a4
to
ec43ca5
Compare
Reverted actions/labeler in #24528 because of this failure in this PR. |
It'd be great to merge this before 8.1, but I don't think we should force anything if CI says no. |
For the failing sample tests, it fails during startup of all dependency containers, it looks like a timeout. |
0d364b2
to
5018b70
Compare
CI error is not related to this PR. |
5018b70
to
489ec73
Compare
Pull request was closed
@atomfrede approved |
This PR uses https://angular.io/api/router/withNavigationErrorHandler to handle navigation error events, which can't be handled by our http interceptor error handlers.
I tried to extract a dedicated class, but failed miserable to have that injected in the config.ts file. Either I got no injector defined or the injected class was wrong/not constructed such that it failed with
... has not method ...
. Looks like I need to refresh my angular skills :(updates #24396
Please make sure the below checklist is followed for Pull Requests.
When you are still working on the PR, consider converting it to Draft (below reviewers) and adding
skip-ci
label, you can still see CI build result at your branch.