-
Notifications
You must be signed in to change notification settings - Fork 6
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
Expander boot handling with error codes #118
base: main
Are you sure you want to change the base?
Conversation
@falkoschindler I moved the error handling to its own pull request |
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.
I have some questions and doubts about the current concept:
- Are error codes meant to be binary flags that can be added to get combined errors like, e.g., 5 = 1 (low voltage) + 4 (no response from motor driver)? If so,
set_error
would overwrite existing errors when setting another one. - Currently,
set_error
can be called withERROR_NONE
, which results in a wrong value forhas_error_
. It looks like theErrorHandling
API would need additional methods likeadd_error
,remove_error
andclear_errors
to cover all cases. But then it might be easier to just expose theerror_codes
map directly. - Is it a good idea to share a common list of error codes across all modules? I can imagine conflicts when a module needs an error similar but not identical to one from another module. We would either need to introduce many error codes with similar names and meanings, or pricisely document error codes per module. If so, I don't see the point in a common list of error codes.
Maybe the current implementation with only two errors in a single module is too early to see the big picture. But at the moment I lean towards a new "error" property in the expander module with two additive codes (connection timeout and connection loss). This way it can be accessed like any other property, used in rules, and added to the core output line.
If we really want a global error property or method in the core module, we can iterate over modules and aggregate errors. But right now there is no benefit.
Branch is restored and diff should be correct now. |
I thought about it, and using a bit mask could solve this. Each error would be a single bit, allowing multiple errors to be combined without overwriting.
With a bit mask, ERROR_NONE is unnecessary, since a value of 0 naturally represents no errors. However, I think we would still need these API methods (
I think some error codes could be in all modules ( |
[Update] Merge main into branch
This is a possible implementation of error codes on the expander module.