mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
43 lines
846 B
Python
43 lines
846 B
Python
# coding=utf-8
|
||
"""
|
||
@project: qabot
|
||
@Author:虎
|
||
@file: app_exception.py
|
||
@date:2023/9/4 14:04
|
||
@desc:
|
||
"""
|
||
from rest_framework import status
|
||
|
||
|
||
class AppApiException(Exception):
|
||
"""
|
||
项目内异常
|
||
"""
|
||
status_code = status.HTTP_200_OK
|
||
|
||
def __init__(self, code, message):
|
||
self.code = code
|
||
self.message = message
|
||
|
||
|
||
class AppAuthenticationFailed(AppApiException):
|
||
"""
|
||
未认证(未登录)异常
|
||
"""
|
||
status_code = status.HTTP_401_UNAUTHORIZED
|
||
|
||
def __init__(self, code, message):
|
||
self.code = code
|
||
self.message = message
|
||
|
||
|
||
class AppUnauthorizedFailed(AppApiException):
|
||
"""
|
||
未授权(没有权限)异常
|
||
"""
|
||
status_code = status.HTTP_403_FORBIDDEN
|
||
|
||
def __init__(self, code, message):
|
||
self.code = code
|
||
self.message = message
|