From be8556cd2bc533fc99bff7790276216675ac3e03 Mon Sep 17 00:00:00 2001 From: Soybean Date: Sat, 7 Sep 2024 11:16:58 +0800 Subject: [PATCH] feat(projects): add app error handler. close #587 --- src/plugins/app.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/app.ts b/src/plugins/app.ts index acdd2ca09..f2080ef7f 100644 --- a/src/plugins/app.ts +++ b/src/plugins/app.ts @@ -1,7 +1,15 @@ import { h } from 'vue'; +import type { App } from 'vue'; import { NButton } from 'naive-ui'; import { $t } from '@/locales'; +export function setupAppErrorHandle(app: App) { + app.config.errorHandler = (err, vm, info) => { + // eslint-disable-next-line no-console + console.error(err, vm, info); + }; +} + export function setupAppVersionNotification() { const canAutoUpdateApp = import.meta.env.VITE_AUTOMATICALLY_DETECT_UPDATE === 'Y';