netlify-plugin-image-optim icon indicating copy to clipboard operation
netlify-plugin-image-optim copied to clipboard

Add error handling to `imagemin`

Open ehmicky opened this issue 5 years ago • 0 comments

imagemin can fail when images are invalid. For example:

Error in file: _site/images/dev-notes/louyang_give_random_options.gif

gifsicle:/tmp/dc6ecfb2-8c1d-42e0-885b-21156391edb5:#91: read error: missing 48918 pixels of image data
gifsicle:/tmp/dc6ecfb2-8c1d-42e0-885b-21156391edb5:#91: fatal error: too many missing pixels, giving up

This is currently being reported as a plugin error. try/catch and utils.build.failBuild() should be used instead to report this as a user error.

ehmicky avatar Nov 05 '20 19:11 ehmicky