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

unwatch should not log a warning when it fails #1003

Open
maximlt opened this issue Jan 3, 2025 · 1 comment · May be fixed by #1018
Open

unwatch should not log a warning when it fails #1003

maximlt opened this issue Jan 3, 2025 · 1 comment · May be fixed by #1018
Labels
type-bug Bug report
Milestone

Comments

@maximlt
Copy link
Member

maximlt commented Jan 3, 2025

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.')
@maximlt maximlt added the type-bug Bug report label Jan 3, 2025
@jbednar
Copy link
Member

jbednar commented Jan 3, 2025

I don't know of any reason it wasn't always an exception, but maybe someone else remembers.

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

Successfully merging a pull request may close this issue.

2 participants