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

refactor(EvseManager): more generic error checking #947

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

a-w50
Copy link
Contributor

@a-w50 a-w50 commented Nov 6, 2024

  • added utility function util::find_first_match, which behaves similar to std::visit:
    • it is given a matcher class as the first argument and a variadic amount of additional arguments, that possibly can have different types
    • the matcher class needs to overload its call operator for each of these types and implement a corresponding matching function
    • find_first_match will then execute the corresponding matching function for each argument in order and return the first value, which evaluates to true
  • this utility function is used to write the check for active fatal errors within the EvseManager in a more generic fashion

Checklist before requesting a review

  • I have performed a self-review of my code
  • [] I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

- added utility function `util::find_first_match`, which behaves similar
  to `std::visit`:
  - it is given a matcher class as the first argument and a variadic
    amount of additional arguments, that possibly can have different
    types
  - the matcher class needs to overload its call operator for each of
    these types and implement a corresponding matching function
  - `find_first_match` will then execute the corresponding matching
    function for each argument in order and return the first value,
    which evaluates to true
- this utility function is used to write the check for active fatal
  errors within the EvseManager in a more generic fashion

Signed-off-by: aw <[email protected]>
Copy link
Contributor

@SirVer SirVer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good for BAZEL. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants