Skip to content

Commit c5b1405

Browse files
committed
better error message when import fails
1 parent 94f6c7e commit c5b1405

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib/text/nbt.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ export function convertToTextOrEmpty(raw: string): StringyMCText[] {
4444

4545
try {
4646
parsed = JSON.parse(raw);
47-
} catch {
47+
} catch (err) {
4848
return [
49-
"An error occurred while parsing the SNBT. If this is a bug, please report it to DPH staff!",
49+
"",
50+
{color:"red",text:"An error occurred while parsing the SNBT."},
51+
{color:"yellow",text:" Please send the "},
52+
{color:"gold",text:"following error message"},
53+
{color:"yellow",text:" to Datapack Hub staff:\n"},
54+
{color:"white",bold:true,text:"Error: "},
55+
{color:"gray",text:err!.toString()}
5056
];
5157
}
5258

0 commit comments

Comments
 (0)