Fix error messages for sub-device access of setters#828
Open
cappel89 wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated exception type to provide clearer, user-facing errors when attempting to modify configuration attributes on sub-devices (which is not supported), and adds tests covering these behaviors.
Changes:
- Added
NotImplementedOnSubdeviceError(anAlarmBase) with a clearer message for unsupported sub-device config operations. - Added sub-device guards to multiple config setters / helpers (e.g.,
enabled,read_only,readout_priority, limits, tags, user parameters). - Added tests that exercise sub-device reads (allowed) vs. writes (now raising the new exception).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
bec_lib/bec_lib/device.py |
Adds NotImplementedOnSubdeviceError and raises it from various config setters when called on sub-devices. |
bec_lib/tests/test_devices.py |
Adds fixtures/tests to verify sub-device config setters raise NotImplementedOnSubdeviceError. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
6d73eb2 to
bc628b1
Compare
d-perl
reviewed
Apr 22, 2026
d-perl
previously approved these changes
Apr 22, 2026
Contributor
d-perl
left a comment
There was a problem hiding this comment.
looks good to me, one comment in code which could save a couple of lines if you wanted, optional
wakonig
reviewed
Apr 23, 2026
wakonig
reviewed
May 7, 2026
| @typechecked | ||
| def set_user_parameter(self, val: dict): | ||
| """set the user parameter for this device""" | ||
| if self.name != self.root.name: |
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.
Changing config attributes of sub-devices is not supported for RPC devices, i.e. read_only, readoutPriority, limits etc. Previously, the error message for this was rather obscure:
This PR fixes this. Error messages for access of relevant attributes of sub-devices has been improved.