chrisdwheatley / netlify-plugin-image-optim

Optimize images as part of your Netlify build process. Optimizes PNG, JPEG, GIF and SVG file formats.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add error handling to `imagemin`

ehmicky opened this issue · 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.