-
Notifications
You must be signed in to change notification settings - Fork 901
Core: clarify error message when reading an APContainer
#2887
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
Core: clarify error message when reading an APContainer
#2887
Conversation
self.read_contents(zf) | ||
except Exception as e: | ||
message = "" | ||
if len(e.args): |
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.
does len
really make sense here over just if e.args
?
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 dislike the python-ism of empty: false, non-empty:true
I've seen other people (in AP discord) say they dislike it also.
It doesn't match other languages, and can take people by surprise. So I prefer to avoid using it.
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.
This change is completely separate from why the version number exists and needs to be bumper. The version number is to make sure that the Patch program can understand what the patch is, not that the Patch program can actually patch the file.
This change for better error reporting is useful regardless of that.
I made this variable for more compatible and safer type narrowing, and then I didn't use if for the type narrowing.
I made this variable for more compatible and safer type narrowing, and then I didn't use if for the type narrowing.
What is this fixing or adding?
Since any game can override
read_contents
inAPContainer
(and might need to),we could use a more clear error message if something goes wrong with that implementation.
A suggestion was made to do something with the version number that's defined in core.
But if the plan is to move games out of core, or have better support for games outside of core, then we can't use a patch version number in core to keep track of changes in game implementations.
The solution needs to be something that is available to games that have never been in core and never will be in core.
How was this tested?
I created a patch before this change: #2875
Then tested opening that patch with #2875 with and without these changes.
Before:
After: