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 severity functions #455

Open
goatshriek opened this issue Oct 1, 2024 · 5 comments
Open

add errors to severity functions #455

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

Comments

@goatshriek
Copy link
Owner

goatshriek commented Oct 1, 2024

The functions dealing with severities 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_severity_string
  • stumpless_get_severity_enum
  • stumpless_get_severity_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 severity functions test/function/severity.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 severity 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_SEVERITY 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 labels Oct 1, 2024
@Sanidhyafeaturist
Copy link

Sanidhyafeaturist commented Oct 14, 2024

Hey, I wanna give in a try to this issue, I am currently understanding this issue, I am not in a hurry just like the previous PRs, so can you give me another chance? :)

@goatshriek
Copy link
Owner Author

You are welcome to work this one if you'd like. Please make sure that your code compiles and passes tests, at least in your own environment, before opening a pull request.

@Sanidhyafeaturist
Copy link

hey actually things aren't working as planned for me, my grandmother died so I don't think that I can work on github right now. I am so sorry

@Sanidhyafeaturist Sanidhyafeaturist removed their assignment Oct 16, 2024
@vedant-jad99
Copy link

Hi, I would like to help and contribute to this project. Can I take this issue?

@goatshriek
Copy link
Owner Author

Sure, 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 help wanted external contributations encouraged
Projects
None yet
Development

No branches or pull requests

3 participants