From 52ae3b579689819333d7e47ea9b3ed509562d4e1 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 9 Mar 2022 10:46:52 +0100 Subject: [PATCH] fix: Fix error type --- src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 9891bc6..b97cc8c 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -53,7 +53,8 @@ export function isBlurhashValid(blurhash: string): { isValid: true } | { isValid try { validateBlurhash(blurhash); } catch (error) { - return { isValid: false, errorReason: error.message }; + const message = error instanceof Error ? error.message : JSON.stringify(error); + return { isValid: false, errorReason: message }; } return { isValid: true };