Repository navigation
Raise a RadioBrowserValidationError for invalid arguments - #1602
Merged
Merged
Conversation
Invalid arguments raised probatio's Invalid, so a caller needed a second except next to RadioBrowserError, and an except ValueError from before 1.0 no longer worked. probatio 0.13.0 lets the decorator raise an error of our own, so raise a RadioBrowserValidationError, which is a RadioBrowserError and a ValueError. The probatio error stays reachable as its cause.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
None compared to the last release (0.3.2). Invalid arguments raised a
ValueErrorthere, andRadioBrowserValidationErroris aValueError, soexcept ValueErrorkeeps working.Compared to main, it undoes most of the breaking change of #1597: code that catches
probatio.Invalidaround radios calls should catchRadioBrowserValidationError(orRadioBrowserError) instead. The probatio error is still reachable as__cause__.Proposed change
Since #1597, an invalid argument raised probatio's
Invalid. That meant a caller needed a secondexceptnext toRadioBrowserError, and anexcept ValueErrorwritten against an earlier release silently stopped catching it.probatio 0.13.0 lets the decorator raise an error of our own (frenck/probatio#437). This adds:
Every public method uses
@probatio(error=RadioBrowserValidationError), and the checks that span several arguments (a location that is incomplete,filter_bywithout afilter_term) raise it themselves. Oneexcept RadioBrowserErrornow covers everything the library raises, and the message still names the argument:The minimum probatio version goes to 0.13.0. Home Assistant pins 0.12.5 today, so the Home Assistant PR that bumps radios needs to bump probatio as well. The README, the docstrings and AGENTS.md describe the new error.
Type of change
Additional information
Checklist
poetry run pytestpasses locally. A pull request cannot be merged unless CI is green.poetry run prek run --all-filespasses (lint, format, and type checks).