Skip to content

Commit d2093f8

Browse files
Berserker66FlySniper
authored andcommitted
Core: trace error to player, if possible. (ArchipelagoMW#2023)
1 parent f3503fb commit d2093f8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

worlds/AutoWorld.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,17 @@ def __new__(mcs, name: str, bases: Tuple[type, ...], dct: Dict[str, Any]) -> Aut
9898

9999
def call_single(multiworld: "MultiWorld", method_name: str, player: int, *args: Any) -> Any:
100100
method = getattr(multiworld.worlds[player], method_name)
101-
return method(*args)
101+
try:
102+
ret = method(*args)
103+
except Exception as e:
104+
message = f"Exception in {method} for player {player}, named {multiworld.player_name[player]}."
105+
if sys.version_info >= (3, 11, 0):
106+
e.add_note(message) # PEP 678
107+
else:
108+
logging.error(message)
109+
raise e
110+
else:
111+
return ret
102112

103113

104114
def call_all(multiworld: "MultiWorld", method_name: str, *args: Any) -> None:

0 commit comments

Comments
 (0)