Skip to content

Commit 14419e8

Browse files
VendorMapVendorMap
andauthored
increased error verbosity. (#161)
* increased error verbosity. * Changed errors to use template literals instead of string concatenation. Removed pnpm-lock. Output the sizes of image 1 and 2 in the case they are different as well --------- Co-authored-by: VendorMap <[email protected]>
1 parent 2f2ddf3 commit 14419e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export default function pixelmatch(img1, img2, output, width, height, options =
3131
throw new Error('Image data: Uint8Array, Uint8ClampedArray or Buffer expected.');
3232

3333
if (img1.length !== img2.length || (output && output.length !== img1.length))
34-
throw new Error('Image sizes do not match.');
34+
throw new Error(`Image sizes do not match. Image 1 size: ${img1.length}, image 2 size: ${img2.length}`);
3535

36-
if (img1.length !== width * height * 4) throw new Error('Image data size does not match width/height.');
36+
if (img1.length !== width * height * 4) throw new Error(`Image data size does not match width/height. Expecting ${width * height * 4}. Got ${img1.length}`);
3737

3838
// check if images are identical
3939
const len = width * height;

0 commit comments

Comments
 (0)