fix: only warn about error handlers on client-side (#3345)

This commit is contained in:
Daniel Roe 2022-02-25 11:04:58 +00:00 committed by GitHub
parent ac63401700
commit d007d02356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,7 +103,7 @@ export default defineNuxtPlugin<{ route: Route, router: Router }>((nuxtApp) => {
const route: Route = reactive(getRouteFromPath(process.client ? window.location.href : nuxtApp.ssrContext.url))
async function handleNavigation (url: string, replace?: boolean): Promise<void> {
if (process.dev && !hooks.error.length) {
if (process.dev && process.client && !hooks.error.length) {
console.warn('No error handlers registered to handle middleware errors. You can register an error handler with `router.onError()`')
}
try {