# -*- coding: utf-8 -*-
from loguru import logger


"""
    自定义异常
"""


class ServiceException(Exception):  # 继承异常类
    def __init__(self, code, msg, desc=None):
        self.code = code
        if desc is None:
            self.msg = msg
        else:
            self.msg = msg % desc

    def __str__(self):
        logger.error("异常编码：{}, 异常描述：{}", self.code, self.msg)



