Skip to content

unwatch should not log a warning when it fails #1003

@maximlt

Description

@maximlt

Reviewing Marc's docstring update work, I saw that unwatch apparently logs a warning if it fails at removing a watcher, there has to be a better way, e.g. raising a LookupError.

    def unwatch(self_, watcher):
        """Remove the given Watcher object (from `watch` or `watch_values`) from this object's list."""
        try:
            self_._register_watcher('remove', watcher, what=watcher.what)
        except Exception:
            self_.warning(f'No such watcher {str(watcher)} to remove.')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions