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 command exception classes #352

Closed
jmakhack opened this issue Oct 14, 2022 · 5 comments · Fixed by #357
Closed

Refactor command exception classes #352

jmakhack opened this issue Oct 14, 2022 · 5 comments · Fixed by #357
Assignees
Labels
best practices Improve the health of the codebase good first issue Good for newcomers hacktoberfest This issue qualifies for the hacktoberfest event help wanted Extra attention is needed java Pull requests that update Java code up for grabs Any issue that is up for grabs
Milestone

Comments

@jmakhack
Copy link
Owner

Task Context

At the moment, NotRecognizedCommandException and NotSupportedCommandException both extend RuntimeException. However, instead of using the taking advantage of how RuntimeException handles error messages, these custom exception classes use a reason field. This task is to take better advantage of what RuntimeException has builtin to its logic.

Acceptance Criteria / Goals

Refactor both command exception classes to take advantage of the message field of the RuntimeException class instead of using the current reason field.

See the following RuntimeException constructor:

/** Constructs a new runtime exception with the specified detail message.
 * The cause is not initialized, and may subsequently be initialized by a
 * call to {@link #initCause}.
 *
 * @param   message   the detail message. The detail message is saved for
 *          later retrieval by the {@link #getMessage()} method.
 */
public RuntimeException(String message) {
    super(message);
}

After making these changes, add simple unit tests for both command exception classes as well.

Additional Notes

Please refer to CONTRIBUTING.md for info on how to setup, build, run, and test this project. Feel free to ping @jmakhack in the comments below with any questions if needed. Also, join the Discord to meet and engage with other contributors!

@jmakhack jmakhack added help wanted Extra attention is needed good first issue Good for newcomers java Pull requests that update Java code best practices Improve the health of the codebase hacktoberfest This issue qualifies for the hacktoberfest event up for grabs Any issue that is up for grabs labels Oct 14, 2022
@jmakhack jmakhack added this to the v2.0.0 milestone Oct 14, 2022
@ron-huberfeld
Copy link
Contributor

Hi @jmakhack , can I handle this issue?

@jmakhack
Copy link
Owner Author

go for it @ron-huberfeld

@ron-huberfeld
Copy link
Contributor

Hi @jmakhack
I'm unable to run the tests.
Where can I find an example?

@jmakhack
Copy link
Owner Author

@ron-huberfeld If you're able to run the project via the steps in CONTRIBUTING.md, the tests will run automatically and prevent the program from starting if the tests fail. In IntelliJ IDEA, the green play button by any test file will work as well.

Worst case scenario, if you're not able to run them successfully locally, all the tests are run as part of the automated pull request pipeline checks.

@ron-huberfeld
Copy link
Contributor

Hi @jmakhack
Can you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
best practices Improve the health of the codebase good first issue Good for newcomers hacktoberfest This issue qualifies for the hacktoberfest event help wanted Extra attention is needed java Pull requests that update Java code up for grabs Any issue that is up for grabs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants