-
Notifications
You must be signed in to change notification settings - Fork 6
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
Minor changes to Code Quality #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reckon that it's better to do it this way (as opposed to catching Exception e
- just for the sake of keeping our code quality relatively high). Hopefully this is the last exception that we'll need to deal with haha
//Fallthrough | ||
case "exit": | ||
//Fallthrough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the necessary changes to improve our code quality!
Summary of Changes:
Storage
RestockCommand and SellCommand
ItemList
Parser
//Fallthrough
statement for the 2 initial switch cases that do not have a break statementUpdateCommandParser
General
For the catching of exceptions in
Storage
There is an alternative solution, which is deemed as bad programming practice in most cases, which is to catch the general exception
catch (Exception e)
.However, in scenarios like file parsing where input can be quite variable and potentially out of the control of our application (e.g., user-modified files), it could be prudent to include such handling to ensure the application remains robust against all forms of bad input. Ultimately, all the exceptions during loading will be handled in the same way: setting
isCorrupted
to True, and creating a new items.txt file.Do LMK you guys' opinion on this.