more descriptive errors

This commit is contained in:
Theis Pieter Hollebeek 2025-10-11 15:24:11 +02:00
parent 2f33871141
commit e35d6c46c9
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ importButton.onclick = async (ev) => {
return; return;
} }
if (files.length > 1) { if (files.length > 1) {
throw new Error("unreachable: something went wrong !"); throw new Error("unreachable: something went wrong ! files.length > 1");
} }
const item = Vermiparous.de(await fetch(URL.createObjectURL(files[0])).then((x) => x.bytes())); const item = Vermiparous.de(await fetch(URL.createObjectURL(files[0])).then((x) => x.bytes()));
}; };

View File

@ -42,7 +42,7 @@ export class Vermiparous {
while (idx < bytes.length) { while (idx < bytes.length) {
buffer.push(bytes[idx]); buffer.push(bytes[idx]);
if (buffer.length >= MAX_KW_LENGTH) { if (buffer.length >= MAX_KW_LENGTH) {
throw new Error("unreachable: something went wrong !"); throw new Error("unreachable: something went wrong ! unrecognized action");
} }
if (buffer.length < MIN_KW_LENGTH || !isKeyword(buffer)) { if (buffer.length < MIN_KW_LENGTH || !isKeyword(buffer)) {
++idx; ++idx;