Commit 23c88d0a authored by J. Fernando Sánchez's avatar J. Fernando Sánchez

Improve error handling

parent dcaaa591
......@@ -16,7 +16,6 @@ import os
import copy
import errno
import logging
import traceback
logger = logging.getLogger(__name__)
......@@ -171,7 +170,6 @@ class Senpy(object):
by api.parse_call().
logger.debug("analysing request: {}".format(request))
entries = request.entries
request.entries = []
plugins = self._get_plugins(request)
......@@ -180,13 +178,6 @@ class Senpy(object):
logger.debug("Returning analysis result: {}".format(results))
except (Error, Exception) as ex:
if not isinstance(ex, Error):
msg = "Error during analysis: {} \n\t{}".format(ex,
ex = Error(message=msg, status=500)
logger.exception('Error returning analysis result')
raise ex
results.analysis = [i['plugin'].id for i in results.analysis]
return results
......@@ -182,8 +182,7 @@ class ExtensionsTest(TestCase):
analyse(self.senpy, input='nothing', algorithm='MOCK')
assert False
except Exception as ex:
assert 'generic exception on analysis' in ex['message']
assert ex['status'] == 500
assert 'generic exception on analysis' in str(ex)
def test_filtering(self):
""" Filtering plugins """
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment