dify/api/libs/exception.py

16 lines
399 B
Python
Raw Normal View History

2023-05-15 08:51:32 +08:00
from werkzeug.exceptions import HTTPException
class BaseHTTPException(HTTPException):
error_code: str = "unknown"
data: dict | None = None
2023-05-15 08:51:32 +08:00
def __init__(self, description=None, response=None):
super().__init__(description, response)
self.data = {
"code": self.error_code,
"message": self.description,
"status": self.code,
}