Better error logging during image optimization