feat: put lib name in err messages
This commit is contained in:
parent
cc26eb6bb5
commit
35e2620939
3 changed files with 4 additions and 4 deletions
|
@ -25,7 +25,7 @@
|
|||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"peerDependencies": {
|
||||
"astro": "^2.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -22,7 +22,7 @@ try {
|
|||
serializedData = use ? use(data) : JSON.stringify(data);
|
||||
} catch(err) {
|
||||
// extend error for helpful messages and guides
|
||||
throw Error(err)
|
||||
throw Error('astro-resume ERR:', err)
|
||||
}
|
||||
---
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ export function deserialize<T = any>(id: string, parser?: (serialized: string)=>
|
|||
|
||||
if (elements?.length > 0) {
|
||||
if (elements?.length > 1)
|
||||
console.warn(`WARNING: Multiple matches for "${id}". There are ${elements?.length} matches found for ID: "${id}". The function will parse the first match found.`)
|
||||
console.warn(`astro-resume WARN: Multiple matches for "${id}". The function will parse the first one.`)
|
||||
|
||||
const element = elements[0];
|
||||
|
||||
|
@ -42,7 +42,7 @@ export function deserialize<T = any>(id: string, parser?: (serialized: string)=>
|
|||
: JSON.parse(element.textContent)
|
||||
}
|
||||
|
||||
throw Error(`ERR: No match found.
|
||||
throw Error(`astro-resume ERR: No match found.
|
||||
"deserialize('${id}')" did not find any data.
|
||||
Check that the following are correct:
|
||||
- The Serialize component is used with correct props
|
||||
|
|
Loading…
Reference in a new issue