Files
life-echo/api/payment/exceptions.py

41 lines
1.1 KiB
Python
Raw Normal View History

"""
支付模块异常定义
"""
class PaymentError(Exception):
"""支付基础异常"""
def __init__(self, message: str = "支付异常", code: str = "PAYMENT_ERROR"):
self.message = message
self.code = code
super().__init__(self.message)
class PaymentConfigError(PaymentError):
"""支付配置异常"""
def __init__(self, message: str = "支付配置错误"):
super().__init__(message=message, code="PAYMENT_CONFIG_ERROR")
class PaymentCreateError(PaymentError):
"""创建支付订单异常"""
def __init__(self, message: str = "创建支付订单失败"):
super().__init__(message=message, code="PAYMENT_CREATE_ERROR")
class PaymentNotifyError(PaymentError):
"""支付回调通知处理异常"""
def __init__(self, message: str = "支付回调处理失败"):
super().__init__(message=message, code="PAYMENT_NOTIFY_ERROR")
class PaymentQueryError(PaymentError):
"""查询支付状态异常"""
def __init__(self, message: str = "查询支付状态失败"):
super().__init__(message=message, code="PAYMENT_QUERY_ERROR")