File size: 1,167 Bytes
e0b68d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""统一异常包。



提供标准化的异常类层次结构,支持:

- 统一的错误码和 HTTP 状态码映射

- 结构化的错误详情

- OpenAI 兼容的错误响应格式

"""

from app.exceptions.base import AppError
from app.exceptions.api import (
    AuthenticationError,
    AuthorizationError,
    ValidationError,
    ModelNotFoundError,
    RateLimitError,
)
from app.exceptions.upstream import (
    UpstreamError,
    UpstreamRateLimited,
    UpstreamTimeout,
    UpstreamConnectionError,
)
from app.exceptions.http import (
    HttpError,
    HttpConnectionError,
    SSLError,
    ProxyError,
    HttpTimeoutError,
)

__all__ = [
    # Base
    "AppError",
    # API errors
    "AuthenticationError",
    "AuthorizationError",
    "ValidationError",
    "ModelNotFoundError",
    "RateLimitError",
    # Upstream errors
    "UpstreamError",
    "UpstreamRateLimited",
    "UpstreamTimeout",
    "UpstreamConnectionError",
    # HTTP errors
    "HttpError",
    "HttpConnectionError",
    "SSLError",
    "ProxyError",
    "HttpTimeoutError",
]