From a7c73f24f76cc570b24d16d436a80e1ed33f4b27 Mon Sep 17 00:00:00 2001 From: seven Date: Sat, 5 Aug 2023 20:06:45 +0800 Subject: [PATCH] use custom error --- components.d.ts | 1 - src/common/customError.ts | 8 ++++++++ src/views/connect/components/add-dialog.vue | 8 +++++--- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 src/common/customError.ts diff --git a/components.d.ts b/components.d.ts index 0ce6250..e911768 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,7 +8,6 @@ export {} declare module 'vue' { export interface GlobalComponents { AppProvider: typeof import('./src/components/AppProvider.vue')['default'] - NAlert: typeof import('naive-ui')['NAlert'] NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] diff --git a/src/common/customError.ts b/src/common/customError.ts new file mode 100644 index 0000000..57879c5 --- /dev/null +++ b/src/common/customError.ts @@ -0,0 +1,8 @@ +export class CustomError extends Error { + constructor( + public readonly status: number, + public readonly details: string, + ) { + super(); + } +} diff --git a/src/views/connect/components/add-dialog.vue b/src/views/connect/components/add-dialog.vue index f28f08d..c368464 100644 --- a/src/views/connect/components/add-dialog.vue +++ b/src/views/connect/components/add-dialog.vue @@ -95,6 +95,7 @@