More clear message for character import failure

This commit is contained in:
Cohee
2023-08-01 18:13:50 +03:00
parent 7f86551ab4
commit 72974d8a54
2 changed files with 10 additions and 0 deletions

View File

@ -61,6 +61,11 @@ const parse = async (cardUrl, format) => {
return PNGtext.decode(chunk.data);
});
if (textChunks.length === 0) {
console.error('PNG metadata does not contain any character data.');
throw new Error('No PNG metadata.');
}
return Buffer.from(textChunks[0].text, 'base64').toString('utf8');
default:
break;