-
Notifications
You must be signed in to change notification settings - Fork 842
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: differentiate between unknown worlds and broken worlds in error message #2903
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
from worlds.alttp.Text import TextTable | ||
from worlds.AutoWorld import AutoWorldRegister | ||
from worlds.generic import PlandoConnection | ||
from worlds import failed_world_loads | ||
|
||
|
||
def mystery_argparse(): | ||
|
@@ -440,7 +441,11 @@ def roll_settings(weights: dict, plando_options: PlandoOptions = PlandoOptions.b | |
|
||
ret.game = get_choice("game", weights) | ||
if ret.game not in AutoWorldRegister.world_types: | ||
picks = Utils.get_fuzzy_results(ret.game, AutoWorldRegister.world_types, limit=1)[0] | ||
picks = Utils.get_fuzzy_results(ret.game, list(AutoWorldRegister.world_types) + failed_world_loads, limit=1)[0] | ||
if picks[0] in failed_world_loads: | ||
raise Exception(f"No functional world found to handle game {ret.game}. " | ||
f"Did you mean '{picks[0]}' ({picks[1]}% sure)? " | ||
f"If so, it appears the world failed to initialize correctly.") | ||
raise Exception(f"No world found to handle game {ret.game}. Did you mean '{picks[0]}' ({picks[1]}% sure)? " | ||
f"Check your spelling or installation of that world.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels like I'm nitpicking, but is it still worth mentioning the installation here, since the failed worlds are handled above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is admittedly a hidden assumption here. At least currently, if you have failed worlds that means you manually installed one, since we ship with only ones that can initialize. So conversely you have to know what you did. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idr exactly, but wasn't fuzzy matching case sensitive? If so, Factorio <-> factorio would be unable to match the 'F', which makes it less likely to find a good result. |
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,13 @@ | |
"user_folder", | ||
"GamesPackage", | ||
"DataPackage", | ||
"failed_world_loads", | ||
} | ||
|
||
|
||
failed_world_loads: List[str] = [] | ||
|
||
|
||
class GamesPackage(TypedDict, total=False): | ||
item_name_groups: Dict[str, List[str]] | ||
item_name_to_id: Dict[str, int] | ||
|
@@ -87,6 +91,7 @@ def load(self) -> bool: | |
file_like.seek(0) | ||
import logging | ||
logging.exception(file_like.read()) | ||
failed_world_loads.append(os.path.basename(self.path).rsplit(".", 1)[0]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really like this because world names may not fuzzy match well against their file path e.g. HK, kh2. But I don't know a better alternative so the code looks good enough to me 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it's the best I could come up with without some much more complex string parsing to try and find the game name. Hopefully it incentivizes better package names. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can change this once we add metadata to the worlds, but that's not a thing yet. |
||
return False | ||
|
||
|
||
|
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.
Would it be possible to add a line along the lines of "If you're filing a bug report, the actual error you're looking for is further up"?
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 have another PR that stops execution at that first error.