Browse Source

properly wrap errors in other modules

pull/46/head
coomdev 2 years ago
parent
commit
08efa6d959
  1. 2
      src/gif.ts
  2. 2
      src/jpg.ts

2
src/gif.ts

@ -48,7 +48,7 @@ const extractBuff = (gif: Buffer) => {
} }
end = sec.end; end = sec.end;
} }
throw "Shouldn't happen"; throw new Error("Shouldn't happen");
// metadata ended, nothing... // metadata ended, nothing...
}; };

2
src/jpg.ts

@ -49,7 +49,7 @@ export const convertToPng = async (f: File): Promise<Blob | undefined> => {
const inject = async (b: File, c: File[]) => { const inject = async (b: File, c: File[]) => {
const pngfile = await convertToPng(b); const pngfile = await convertToPng(b);
if (!pngfile || pngfile.size > 3000 * 1024) { if (!pngfile || pngfile.size > 3000 * 1024) {
throw "Couldn't convert file to PNG: resulting filesize too big."; throw new Error("Couldn't convert file to PNG: resulting filesize too big.");
} }
return pngv3.inject!(new File([pngfile], b.name), c); return pngv3.inject!(new File([pngfile], b.name), c);
}; };

Loading…
Cancel
Save