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

add errors to facility functions #456

Open
goatshriek opened this issue Oct 3, 2024 · 2 comments
Open

add errors to facility functions #456

goatshriek opened this issue Oct 3, 2024 · 2 comments
Assignees
Labels
enhancement new features or improvements good first issue something that would be simple for a newcomer to stumpless to work on hacktoberfest a good candidate for hacktoberfest participants help wanted external contributations encouraged

Comments

@goatshriek
Copy link
Owner

The functions dealing with facilities do not currently properly handle error codes. They should generate appropriate error messages when a failure occurs, so that users checking for errors are properly notified. Additionally, errors should be cleared in the event of success so that an error is not mistakenly identified for a successful call. The affected functions are:

  • stumpless_get_facility_string
  • stumpless_get_facility_enum
  • stumpless_get_facility_enum_from_buffer

General Approach

There are a few details left out of the following approach, for you to fill in as you encounter them. If you find you need help, please ask here or on the project gitter and someone can help you get past the stumbling block.

Add your new tests to the test suite for the facility functions test/function/facility.cpp. Each function should have a new test for error clearing, and the existing tests should be enhanced.

The new tests will cause a failure by misusing a different function in order to purposefully generate an error. stumpless_version_to_string is a simple function to misuse (pass it a NULL arg) as one candidate. Assert that there is in fact an error with EXPECT_ERROR_ID_EQ. It will then call the facility function normally, check the result, and ensure that no error is raised with EXPECT_NO_ERROR. Look to other tests for usage of these expect macros. Ensure that the new tests fail, and then add calls to clear_error in the functions themselves to fix the issue.

For existing tests, add calls to EXPECT_ERROR_ID_EQ with STUMPLESS_INVALID_FACILITY as the expected error. Update the functions themselves to raise this error upon failure, and update the documentation to reflect this behavior.

@goatshriek goatshriek added enhancement new features or improvements help wanted external contributations encouraged good first issue something that would be simple for a newcomer to stumpless to work on hacktoberfest a good candidate for hacktoberfest participants labels Oct 3, 2024
@Ankaa19
Copy link

Ankaa19 commented Oct 9, 2024

Hello,
I would like to work on this issue. Could you assign me?
Than you a lot.

@goatshriek
Copy link
Owner Author

Sure thing, good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new features or improvements good first issue something that would be simple for a newcomer to stumpless to work on hacktoberfest a good candidate for hacktoberfest participants help wanted external contributations encouraged
Projects
None yet
Development

No branches or pull requests

2 participants