feat: add helpful error message when data is unserializable
This commit is contained in:
parent
632e433add
commit
71a0e27c61
1 changed files with 9 additions and 2 deletions
|
@ -21,8 +21,15 @@ let serializedData = '{}'
|
||||||
try {
|
try {
|
||||||
serializedData = use ? use(data) : JSON.stringify(data);
|
serializedData = use ? use(data) : JSON.stringify(data);
|
||||||
} catch(err) {
|
} 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)
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue