- 定义
from log import logger
class AsstException(Exception):
def __init__(self, message):
super().__init__(message)
logger.error(message)
- 使用
from exception import AsstException
class Messenger(object):
def __init__(self, sc_key):
if not sc_key:
raise AsstException('sc_key can not be empty')