refactor: 将ErrorTemplate中的方法改为静态方法

This commit is contained in:
IZUMI-Zu 2025-07-28 23:41:35 +08:00
parent 50e3259693
commit f4ccd13dc1
1 changed files with 9 additions and 6 deletions

View File

@ -16,11 +16,14 @@ class Errors:
class ErrorTemplate:
def ARGUMENT_LACK(did): return HTTPException(
Code.NOT_FOUND, '参数[%s]不能为空' % did)
@staticmethod
def ARGUMENT_LACK(did: str = "参数") -> HTTPException:
return HTTPException(Code.NOT_FOUND, '参数[%s]不能为空' % did)
def ARGUMENT_ERROR(did): return HTTPException(
Code.NOT_FOUND, '参数[%s]有错' % did)
@staticmethod
def ARGUMENT_ERROR(did: str = "参数") -> HTTPException:
return HTTPException(Code.NOT_FOUND, '参数[%s]有错' % did)
def TIP_ARGUMENT_ERROR(did): return HTTPException(
Code.NOT_FOUND, '请输入正确的%s地址' % did)
@staticmethod
def TIP_ARGUMENT_ERROR(did: str = "链接") -> HTTPException:
return HTTPException(Code.NOT_FOUND, '请输入正确的%s地址' % did)