MRI: Actually throw ENOENT for missing files #137
No reviewers
Labels
No Label
RGSS accuracy
bug
compilation
discussion
documentation
duplicate
enhancement
invalid
performance issue
port request
question
ruby incompatibility
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: MapleShrine/mkxp#137
Loading…
Reference in New Issue
No description provided.
Delete Branch "mook/filesystem-enoent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The wrong exception (
EOFError
instead ofErrno::ENOENT
) was being raised whenload_data()
was being passed an invalid path.Test case (global scope in
Main
should do):Yes, I actually found a game that did that, and handled
Errno:ENOENT
:|Thanks for the feedback! Not sure why GitHub seems to have lost it; it can be found at mook/mkxp@75f6a8c372. Made an attempt at fixing the other error codes too, but I assume they could use improvement. Checked that the test case above still passes.
Ah, sorry, I must have commented on the commit in your fork instead of in this RP.
What other error codes are wrong?
Sorry, I just meant that I tried to sort the other physfs error codes in the same spot to other Ruby exceptions but am not confident I'm translating those correctly. I also suspect that some of the things I'm checking for can't actually occur at that point. At worst though it just means a different exception than expected.
There are exactly two expected cases when the call comes from
load_data
(ie. code we don't control):Looking at the physfs header, the 2nd case would be covered by
PHYSFS_ERR_NOT_FOUND
andPHYSFS_ERR_NOT_A_FILE
. Every other error is irrelevant to the user script, and points to a mkxp-internal problem instead. Since we can't deal with it in a proper fashion, we just throw a genericException::PHYSFSError
with the error string provided by physfs. The ruby code is not expected to be able to deal with it, but at least the user can report the error and it can be investigated. I've never encountered this case though.Okay, changed to handle just those two errors. Left it as a
switch
because it looked cleaner than anif
to me.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Forgejo.