How to handle navigation errors in ErrorHandler
?
I tried using the following condition to check whether Error
object is of NavigationError
but it says false.
export class AppErrorHandler implements ErrorHandler {
constructor() { }
handleError(error: Error) {
if (error instanceof NavigationError) {
//do something here, may be notify or redirect to error page.
}
}
How to handle router navigation errors in
ErrorHandler
? I don't want to add wildcard routing.
Will the above condition works if the type is correct? If so, against what type I should check?