Overview
Improved the logic in the getElement method that handles strings containing only digits, by changing the name of the exception variable from ex to ignored. This change clarifies that the exception is intentionally not being addressed.
Changes
- Renamed the
IllegalArgumentExceptionvariable toignoredto clearly indicate the intention behind the exception handling.
Background
The getElement method checks if the given string's postfix consists only of numbers, and if so, attempts to create and return an AnsiElement. During this process, calling Integer.parseInt(postfix) may throw an IllegalArgumentException, which is currently ignored without any specific handling. By renaming the exception variable to ignored, we aim to make it clear that this exception is intentionally overlooked, thus improving the readability of the code.
Expected Impact
This change is intended to enhance the clarity of the code's intent, assisting other developers in understanding and maintaining the code more efficiently. Additionally, it contributes to maintaining consistent exception handling practices within the code.
Thank you.
Comment From: pivotal-cla
@xpmxf4 Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@xpmxf4 Thank you for signing the Contributor License Agreement!
Comment From: mhalbritter
Thanks!
Comment From: mhalbritter
Sorry, I merged this too soon. We decided to revert this change, as this would make the codebase (more) inconsistent. I've went through all our empty catch blocks and made sure they had a // Ignore comment in them.
Comment From: xpmxf4
It's totally okay and thanks for the reply! It was a great lesson to learn how much is important to keep the consistency of the project!