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

bounds checks: log warnings instead of raising errors #6

Closed
onyx-and-iris opened this issue Jun 30, 2023 · 0 comments
Closed

bounds checks: log warnings instead of raising errors #6

onyx-and-iris opened this issue Jun 30, 2023 · 0 comments

Comments

@onyx-and-iris
Copy link
Owner

onyx-and-iris commented Jun 30, 2023

example in vban class:

    @sr.setter
    def sr(self, val: int):
        opts = (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
        if val not in opts:
            raise VMError(f"Expected one of: {opts}")

we might instead:

    @sr.setter
    def sr(self, val: int):
        opts = (11025, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000)
        if val not in opts:
            self.logger.warning(f"sr got {val} but expected a value in {opts}")

it might be better for us to simply log these occurrences as warnings for the following reasons:

  • it's documented in the README which values are expected
  • I don't think passing a value out of bounds is severe enough to raise an Error.
  • the C-API will silently ignore unexpected values so it won't cause an issue at a lower level.
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

1 participant