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

[Docs]Callback exception sends error msg to agent, not documented #3

Open
Oscar-Campo opened this issue May 7, 2019 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@Oscar-Campo
Copy link
Contributor

A message is sent automatically to the agent when an exception is raised from the callback.

Perhaps this must be written inside SDK documentation.

def _wrapped_cb_execution(self, f):
"""Wrap callback execution and send error to agent.
"""
if f is None:
return None
@wraps(f)
def wrapper(*args, **kwargs):
try:
f(*args, **kwargs)
except Exception as exc:
exc_dump = json.dumps({
'type': exc.__class__.__name__,
'msg': str(exc)
})
# Format signal message
exc_msg = Msg(
payload=self._err_msg.format(exc_dump).encode(),
type=True,
channel=None
)
self._buffer.put(exc_msg) # En-quque msg blocking
return wrapper

@Oscar-Campo Oscar-Campo added the enhancement New feature or request label May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant