mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
SNIClient: log exceptions and keep task alive (#3911)
* SNIClient: log exceptions and keep task alive * also log errors in `get_handler` and disconnect if error in `game_watcher`
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
import abc
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, ClassVar, Dict, Iterable, Tuple, Any, Optional, Union
|
||||
|
||||
from typing_extensions import TypeGuard
|
||||
@@ -60,8 +61,12 @@ class AutoSNIClientRegister(abc.ABCMeta):
|
||||
@staticmethod
|
||||
async def get_handler(ctx: SNIContext) -> Optional[SNIClient]:
|
||||
for _game, handler in AutoSNIClientRegister.game_handlers.items():
|
||||
if await handler.validate_rom(ctx):
|
||||
return handler
|
||||
try:
|
||||
if await handler.validate_rom(ctx):
|
||||
return handler
|
||||
except Exception as e:
|
||||
text_file_logger = logging.getLogger()
|
||||
text_file_logger.exception(e)
|
||||
return None
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user