server/images: fix processing errors
This commit is contained in:
parent
4dcee37567
commit
6bff0a6a26
2 changed files with 4 additions and 3 deletions
|
@ -40,7 +40,7 @@ def _on_not_found_error(ex, _request, _response, _params):
|
||||||
raise falcon.HTTPNotFound(title='Not found', description=str(ex))
|
raise falcon.HTTPNotFound(title='Not found', description=str(ex))
|
||||||
|
|
||||||
def _on_processing_error(ex, _request, _response, _params):
|
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():
|
def create_app():
|
||||||
''' Create a WSGI compatible App object. '''
|
''' Create a WSGI compatible App object. '''
|
||||||
|
|
|
@ -38,11 +38,12 @@ class Image(object):
|
||||||
|
|
||||||
def _execute(self, cli):
|
def _execute(self, cli):
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
['ffmpeg'] + cli,
|
['ffmpeg', '-loglevel', '24'] + cli,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
out, err = proc.communicate(input=self.content)
|
out, err = proc.communicate(input=self.content)
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise errors.ConversionError(err)
|
raise errors.ProcessingError(
|
||||||
|
'Error while processing image.\n' + err.decode('utf-8'))
|
||||||
return out
|
return out
|
||||||
|
|
Loading…
Reference in a new issue