paper-dynasty-discord/exceptions.py
2024-11-03 21:54:55 -06:00

37 lines
752 B
Python

import logging
from typing import Literal
def log_exception(e: Exception, msg: str = '', level: Literal['debug', 'error', 'info', 'warn'] = 'error'):
if level == 'debug':
logging.debug(msg, stack_info=True)
elif level == 'error':
logging.error(msg, stack_info=True)
elif level == 'info':
logging.info(msg, stack_info=True)
else:
logging.warning(msg, stack_info=True)
raise e(msg)
class GameException(Exception):
pass
class LineupsMissingException(GameException):
pass
class CardLegalityException(GameException):
pass
class GameNotFoundException(GameException):
pass
class TeamNotFoundException(GameException):
pass
class PlayNotFoundException(GameException):
pass