初次提交
This commit is contained in:
23
backend/app/exceptions/auth.py
Normal file
23
backend/app/exceptions/auth.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
class EmailAlreadyExistsException(HTTPException):
|
||||
"""邮箱已存在异常"""
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail={
|
||||
"code": "EMAIL_EXISTS",
|
||||
"message": "邮箱已被注册"
|
||||
}
|
||||
)
|
||||
|
||||
class UsernameAlreadyExistsException(HTTPException):
|
||||
"""用户名已存在异常"""
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail={
|
||||
"code": "USERNAME_EXISTS",
|
||||
"message": "用户名已存在"
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user