Skip to content

Commit 902c82d

Browse files
committed
docs: rename isRouterError [skip ci]
1 parent bb90585 commit 902c82d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

docs/guide/advanced/navigation-failures.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ When using a regular `router-link`, **none of these failures will log an error**
1212

1313
## Detecting Navigation Failures
1414

15-
_Navigation Failures_ are `Error` instances with a few extra properties. To check if an error comes from the Router, use the `isRouterError` function:
15+
_Navigation Failures_ are `Error` instances with a few extra properties. To check if an error comes from the Router, use the `isNavigationFailure` function:
1616

1717
```js
18-
import { NavigationFailureType, isRouterError } from 'vue-router'
18+
import { NavigationFailureType, isNavigationFailure } from 'vue-router'
1919

2020
// trying to access the admin page
2121
router.push('/admin').catch(failure => {
2222
if (failure) {
23-
if (isRouterError(failure, NavigationFailureType.redirected)) {
23+
if (isNavigationFailure(failure, NavigationFailureType.redirected)) {
2424
// show a small notification to the user
2525
showToast('Login in order to access the admin panel')
2626
}
@@ -29,7 +29,7 @@ router.push('/admin').catch(failure => {
2929
```
3030

3131
::: tip
32-
If you omit the second parameter: `isRouterError(failure)`, it will only check if the error comes from the Router.
32+
If you omit the second parameter: `isNavigationFailure(failure)`, it will only check if the error comes from the Router.
3333
:::
3434

3535
## `NavigationFailureType`
@@ -48,12 +48,11 @@ Apart from exposing a `type` property, all navigation failures expose `to` and `
4848
```js
4949
// trying to access the admin page
5050
router.push('/admin').catch(failure => {
51-
if (failure) {
52-
if (isRouterError(failure, NavigationFailureType.redirected)) {
53-
failure.to.path // '/admin'
54-
failure.from.path // '/'
55-
}
51+
if (isNavigationFailure(failure, NavigationFailureType.redirected)) {
52+
failure.to.path // '/admin'
53+
failure.from.path // '/'
5654
}
55+
})
5756
```
5857

5958
In all cases, `from` and `to` are normalized route locations.

0 commit comments

Comments
 (0)