enthought / enthought/traits

Add error handling for async observers

Open
#1,783 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

For normal (synchronous) Traits observers, if an exception occurs then we execute Traits's exception handler, which by default simply logs the exception. The relevant code (or at least part of it) is here: https://github.com/enthought/traits/blob/53654f9bf8bfe353a63ab3a71fdd0869609e9502/traits/observation/_trait_event_notifier.py#L121-L124

For asynchronous Traits observers as introduced by PR #1770, exceptions occurring in the observer are swallowed entirely, with no easy way to log the exception.

It would be useful to have the option to act on the exception in some way (for example, by logging). This would probably entail adding a Traits-specific wrapper around the coroutine to be executed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.