Improve error reporting of JPEG image encoder

OpenCV issue #2604

After this patch applied an attempt to encode empty images produces exception
saying "Raw image encoder error: Empty JPEG image (DNL not supported)"