Process libjpeg errors the OpenCV way

Errors from libjpeg, specifically "Corrupted JPEG data" messages, are printed to `stderr` by the default error handler, making those errors uncatchable. By overwriting the `output_message` method as suggested by the libjpeg docs we can handle those errors like regular OpenCV errors.