From: Eduardo San Martin Morote Date: Mon, 28 Dec 2020 10:36:39 +0000 (+0100) Subject: feat(warn): more specific warnings X-Git-Tag: v4.0.3~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2cd8d867beda6f7c54578d40934774547866e069;p=thirdparty%2Fvuejs%2Frouter.git feat(warn): more specific warnings --- diff --git a/src/navigationGuards.ts b/src/navigationGuards.ts index 7db4d4c7..3f665c30 100644 --- a/src/navigationGuards.ts +++ b/src/navigationGuards.ts @@ -52,7 +52,9 @@ function registerGuard( */ export function onBeforeRouteLeave(leaveGuard: NavigationGuard) { if (__DEV__ && !getCurrentInstance()) { - warn('onBeforeRouteLeave must be called at the top of a setup function') + warn( + 'getCurrentInstance() returned null. onBeforeRouteLeave() must be called at the top of a setup function' + ) return } @@ -63,7 +65,9 @@ export function onBeforeRouteLeave(leaveGuard: NavigationGuard) { if (!activeRecord) { __DEV__ && - warn('onBeforeRouteLeave must be called at the top of a setup function') + warn( + 'No active route record was found. Are you missing a component?' + ) return } @@ -79,7 +83,9 @@ export function onBeforeRouteLeave(leaveGuard: NavigationGuard) { */ export function onBeforeRouteUpdate(updateGuard: NavigationGuard) { if (__DEV__ && !getCurrentInstance()) { - warn('onBeforeRouteUpdate must be called at the top of a setup function') + warn( + 'getCurrentInstance() returned null. onBeforeRouteUpdate() must be called at the top of a setup function' + ) return } @@ -90,7 +96,9 @@ export function onBeforeRouteUpdate(updateGuard: NavigationGuard) { if (!activeRecord) { __DEV__ && - warn('onBeforeRouteUpdate must be called at the top of a setup function') + warn( + 'No active route record was found. Are you missing a component?' + ) return }