Skip to content

Introducing ErrorCode #253

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

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

andreagilardoni
Copy link
Contributor

The objective of this PR is to introduce a method to provide better error codes to our apis.

This is intended to provide:

  • Error codes, different from the generic 0 value return
  • Unified error codes values

In order to update catch2 the following changes were made:
- CMakeLists.txt: import catch2 with FetchContent_Declare, this will
  make it more flexible and easier to update
- removed main for tests, since it is not mandatory and it doesn't add
  any value of having it
- renaming includes in all the files
error: moving ‘a’ of type ‘arduino::String’ to itself [-Werror=self-move]
Which may happen if if GCC_VERSION is not defined, and instead __GNUC__
is defined
since for catch2 '[' is not a valid character in the tag name
@andreagilardoni andreagilardoni force-pushed the error-codes branch 2 times, most recently from 6b5823b to 937662c Compare July 17, 2025 15:04
The objective of error code class to wrap an integer that may be
returned from a function that may fail for different reasons. Since we
are not able to return values different from 0 in case of error in the
arduino language we need to wrap them into this class and redefine
boolean operator to mantain the same behaviour
The objective of ReturnValue is to maintain coherency with ErrorCode
class in cases where a single value is used to represent both the error
and the return value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants