Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Handling #227

Open
Victsz opened this issue Feb 4, 2020 · 3 comments
Open

Exception Handling #227

Victsz opened this issue Feb 4, 2020 · 3 comments

Comments

@Victsz
Copy link

Victsz commented Feb 4, 2020

Hit an exception inside the zerorpc/decorators, but during handling of the above exception, another exception occurred.

Traceback (most recent call last):
  File "/home/victor/.local/share/virtualenvs/elk-K9Q5hUCP/lib/python3.7/site-packages/zerorpc/decorators.py", line 53, in _zerorpc_args
    args_spec = self._functor._zerorpc_args()
AttributeError: 'function' object has no attribute '_zerorpc_args'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/victor/.local/share/virtualenvs/elk-K9Q5hUCP/lib/python3.7/site-packages/zerorpc/core.py", line 153, in _async_task
    functor.pattern.process_call(self._context, bufchan, event, functor)
  File "/home/victor/.local/share/virtualenvs/elk-K9Q5hUCP/lib/python3.7/site-packages/zerorpc/patterns.py", line 30, in process_call
    result = functor(*req_event.args)
  File "/home/victor/.local/share/virtualenvs/elk-K9Q5hUCP/lib/python3.7/site-packages/zerorpc/decorators.py", line 44, in __call__
    return self._functor(*args, **kargs)
  File "/home/victor/.local/share/virtualenvs/elk-K9Q5hUCP/lib/python3.7/site-packages/zerorpc/core.py", line 109, in _zerorpc_inspect
    doc=f._zerorpc_doc())) for (m, f) in iteritems(methods))
  File "/home/victor/.local/share/virtualenvs/elk-K9Q5hUCP/lib/python3.7/site-packages/zerorpc/core.py", line 109, in <genexpr>
    doc=f._zerorpc_doc())) for (m, f) in iteritems(methods))
  File "/home/victor/.local/share/virtualenvs/elk-K9Q5hUCP/lib/python3.7/site-packages/zerorpc/decorators.py", line 56, in _zerorpc_args
    args_spec = inspect.getargspec(self._functor)
  File "/usr/lib/python3.7/inspect.py", line 1082, in getargspec
    raise ValueError("Function has keyword-only parameters or annotations"
ValueError: Function has keyword-only parameters or annotations, use getfullargspec() API which can support them

@bombela
Copy link
Member

bombela commented Feb 4, 2020

What is the signature of your handler function?

@Victsz
Copy link
Author

Victsz commented Feb 4, 2020

There are many functions, we suspect its about the following one:
def InitStrat(self, endPointKey, stratID, stratType, params):
msg = ""
if endPointKey not in self.operators:
msg = f"{endPointKey} not connected. Please use ConnectEndpoint to connect"
return [False, msg]
o: Operator = self.operators[endPointKey]

    try:
       /*do stuff*/
    except Exception as ex:
        msg = f"{endPointKey} request  InitStrat failed {ex}"
        logging.info(msg)
        logging.exception(ex)
        self.sendMsg(stratID, self.msgLevel["CRITICAL"], msg)
        return [False, msg]

@bombela
Copy link
Member

bombela commented Feb 4, 2020

I don't see any obvious problem. Can you provide a full test with a server and a client that produces the error please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants