-
Notifications
You must be signed in to change notification settings - Fork 340
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
Comments
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? :) |
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. |
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 |
Hi, I would like to help and contribute to this project. Can I take this issue? |
Sure, good luck! |
@goatshriek : Can I take this up if no one is working on it? |
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 withEXPECT_ERROR_ID_EQ
. It will then call the severity function normally, check the result, and ensure that no error is raised withEXPECT_NO_ERROR
. Look to other tests for usage of these expect macros. Ensure that the new tests fail, and then add calls toclear_error
in the functions themselves to fix the issue.For existing tests, add calls to
EXPECT_ERROR_ID_EQ
withSTUMPLESS_INVALID_SEVERITY
as the expected error. Update the functions themselves to raise this error upon failure, and update the documentation to reflect this behavior.The text was updated successfully, but these errors were encountered: