You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/guide/advanced/navigation-failures.md
+10-6
Original file line number
Diff line number
Diff line change
@@ -10,22 +10,26 @@ When using a regular `router-link`, **none of these failures will log an error**
10
10
11
11
## Detecting Navigation Failures
12
12
13
-
_Navigation Failures_ are `Error` instances with a few extra properties. Among them, you can find a `type` property. This will allow you to check the type of the navigation failure:
13
+
_Navigation Failures_ are `Error` instances with a few extra properties. To check if an error comes from the Router, use the `isRouterError` function:
Apart from exposing a `type` property, all navigation failures expose `to` and `from` properties to reflect the current location as well as the target location for the navigation that failed:
41
45
42
46
```js
43
-
//given we are at `/`
47
+
//trying to access the admin page
44
48
router.push('/admin').catch(failure=> {
45
49
if (failure) {
46
-
if (failure.type===NavigationFailureType.redirected) {
50
+
if (isRouterError(failure, NavigationFailureType.redirected)) {
0 commit comments