DEEPaaS icon indicating copy to clipboard operation
DEEPaaS copied to clipboard

Exceptions in predict are not propagated to the user

Open IgnacioHeredia opened this issue 7 months ago • 0 comments

When a module throws an Exception, the Exception is not forwarded to the user

def predict(**kwargs):
    raise Exception('Test exceptions')

--> Swagger output:

Response body:
500 Internal Server Error
Server got itself in trouble

At some point, I do remember the following approach worked for forwarding errors, but it no longer does:

from aiohttp.web import HTTPBadRequest

def predict(**kwargs):
    raise HTTPBadRequest(reason='Test exceptions')

Swagger seems frozen, and deepaas process throws the following error:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/home/iheredia/anaconda3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/iheredia/anaconda3/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/iheredia/anaconda3/lib/python3.8/multiprocessing/pool.py", line 576, in _handle_results
    task = get()
  File "/home/iheredia/anaconda3/lib/python3.8/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
TypeError: __init__() takes 1 positional argument but 2 were given

IgnacioHeredia avatar Jul 23 '24 11:07 IgnacioHeredia