From 7b29469e0ec69dad651b77cf1fe85511bdf6cf78 Mon Sep 17 00:00:00 2001 From: Barnaby <22575741+barnabwhy@users.noreply.github.com> Date: Thu, 13 Jun 2024 22:07:23 +0100 Subject: [PATCH] fix vpk load error --- src/stores/main.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/stores/main.ts b/src/stores/main.ts index 695a4b4..4611b7a 100644 --- a/src/stores/main.ts +++ b/src/stores/main.ts @@ -39,7 +39,17 @@ export const useStore = defineStore('main', () => { loading.value = false; loaded.value = false; hasError.value = true; - error.value = JSON.parse(e); + switch (typeof e) { + case 'string': + error.value = e; + break; + case 'object': + error.value = JSON.stringify(e); + break; + default: + error.value = 'An unknown error occurred'; + break; + } } }