Closed shinnn closed 9 years ago
In which module? imagemin?
Plugins.
For example, imagemin-webp outputs the error like this:
Error: Command failed: Corrupt JPEG data: 26 extraneous bytes before marker 0xc2
Quantization table 0x00 was not defined
Error! Could not process file /var/folders/2n/y4hbl_pd05l41w9rh15mm4700000gn/T/8b39daba-b14c-4c0a-b74e-5f12538e7d54
Error! Cannot read input picture file '/var/folders/2n/y4hbl_pd05l41w9rh15mm4700000gn/T/8b39daba-b14c-4c0a-b74e-5f12538e7d54'
And imagemin-jpeg-recompress does:
Error: Corrupt JPEG data: 26 extraneous bytes before marker 0xc2
Quantization table 0x00 was not defined
I think it's better to set fileName
property of the error, like gulp plugins do.
Example implementation:
exec.run(file.contents, function (err, buf) {
if (err) {
err.fileName = err.fileName || file.path; // set fileName property if it's not specified
cb(err);
return;
}
file.contents = buf;
cb(null, file);
});
@shinnn, we should do this.
@kevva I'll update plugins.
This should be fixed now.
Thanks, @kevva.
I want to check which image file is corrupt when optimization fails.