Core: trace error to player, if possible. (#2023)
This commit is contained in:
parent
bb069443a4
commit
6a96f33ad2
|
@ -98,7 +98,17 @@ class AutoLogicRegister(type):
|
||||||
|
|
||||||
def call_single(multiworld: "MultiWorld", method_name: str, player: int, *args: Any) -> Any:
|
def call_single(multiworld: "MultiWorld", method_name: str, player: int, *args: Any) -> Any:
|
||||||
method = getattr(multiworld.worlds[player], method_name)
|
method = getattr(multiworld.worlds[player], method_name)
|
||||||
return method(*args)
|
try:
|
||||||
|
ret = method(*args)
|
||||||
|
except Exception as e:
|
||||||
|
message = f"Exception in {method} for player {player}, named {multiworld.player_name[player]}."
|
||||||
|
if sys.version_info >= (3, 11, 0):
|
||||||
|
e.add_note(message) # PEP 678
|
||||||
|
else:
|
||||||
|
logging.error(message)
|
||||||
|
raise e
|
||||||
|
else:
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def call_all(multiworld: "MultiWorld", method_name: str, *args: Any) -> None:
|
def call_all(multiworld: "MultiWorld", method_name: str, *args: Any) -> None:
|
||||||
|
|
Loading…
Reference in New Issue