Handle errors in JPEG (de)compression library