From 71a0e27c61d51154d21fd9e257d7958f878a7f3c Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 5 Aug 2023 04:48:35 +0200 Subject: [PATCH] feat: add helpful error message when data is unserializable --- src/Serialize.astro | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Serialize.astro b/src/Serialize.astro index 19e6690..f7bfb8e 100644 --- a/src/Serialize.astro +++ b/src/Serialize.astro @@ -21,8 +21,15 @@ let serializedData = '{}' try { serializedData = use ? use(data) : JSON.stringify(data); } catch(err) { - // extend error for helpful messages and guides - throw Error('astro-resume ERR:', err) + /** + * ERR: data is unserializable + * - You might need a custom serializer/parser for complex data + * - Usage examples in 👉 https://git.sr.ht/~ayoayco/astro-resume#astro-resume + */ + throw Error(`astro-resume ERR: Data unserializable +- You might need a custom serializer/parser for complex data +- Usage examples in 👉 https://git.sr.ht/~ayoayco/astro-resume#astro-resume + `, err) } ---