-
Notifications
You must be signed in to change notification settings - Fork 28
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
Update to offer more helpful error message if str fallback is used wi… #752
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you for addressing this quickly! I've added a couple of nit-picks but they're just over style, take them or leave them
src/ophyd_async/epics/core/_aioca.py
Outdated
if valid_choices is not None and len(valid_choices) > 0: | ||
if value not in valid_choices: | ||
msg = ( | ||
f"{value} is not a valid choice for {self.write_pv}, " | ||
f"valid choices: {self.converter.metadata.get('choices')}" | ||
) | ||
raise ValueError(msg) from exc | ||
else: | ||
raise | ||
else: | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could: I don't think the else statements are needed:
if valid_choices is not None and len(valid_choices) > 0: | |
if value not in valid_choices: | |
msg = ( | |
f"{value} is not a valid choice for {self.write_pv}, " | |
f"valid choices: {self.converter.metadata.get('choices')}" | |
) | |
raise ValueError(msg) from exc | |
else: | |
raise | |
else: | |
raise | |
if valid_choices is not None and len(valid_choices) > 0: | |
if value not in valid_choices: | |
msg = ( | |
f"{value} is not a valid choice for {self.write_pv}, " | |
f"valid choices: {self.converter.metadata.get('choices')}" | |
) | |
raise ValueError(msg) from exc | |
raise |
Co-authored-by: Dominic Oram <[email protected]>
…th enum
Addresses #750