server/images: fix processing errors

This commit is contained in:
rr- 2016-04-10 17:04:25 +02:00
parent 4dcee37567
commit 6bff0a6a26
2 changed files with 4 additions and 3 deletions

View file

@ -40,7 +40,7 @@ def _on_not_found_error(ex, _request, _response, _params):
raise falcon.HTTPNotFound(title='Not found', description=str(ex))
def _on_processing_error(ex, _request, _response, _params):
raise falcon.HTTPNotFound(title='Processing error', description=str(ex))
raise falcon.HTTPBadRequest(title='Processing error', description=str(ex))
def create_app():
''' Create a WSGI compatible App object. '''

View file

@ -38,11 +38,12 @@ class Image(object):
def _execute(self, cli):
proc = subprocess.Popen(
['ffmpeg'] + cli,
['ffmpeg', '-loglevel', '24'] + cli,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.communicate(input=self.content)
if proc.returncode != 0:
raise errors.ConversionError(err)
raise errors.ProcessingError(
'Error while processing image.\n' + err.decode('utf-8'))
return out