crypticorn 2.5.0rc1__py3-none-any.whl → 2.5.0rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crypticorn/common/exceptions.py +12 -18
- {crypticorn-2.5.0rc1.dist-info → crypticorn-2.5.0rc2.dist-info}/METADATA +1 -1
- {crypticorn-2.5.0rc1.dist-info → crypticorn-2.5.0rc2.dist-info}/RECORD +6 -6
- {crypticorn-2.5.0rc1.dist-info → crypticorn-2.5.0rc2.dist-info}/WHEEL +0 -0
- {crypticorn-2.5.0rc1.dist-info → crypticorn-2.5.0rc2.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.5.0rc1.dist-info → crypticorn-2.5.0rc2.dist-info}/top_level.txt +0 -0
crypticorn/common/exceptions.py
CHANGED
@@ -1,33 +1,27 @@
|
|
1
1
|
from typing import Optional, Dict
|
2
|
-
from pydantic import BaseModel
|
2
|
+
from pydantic import BaseModel, Field
|
3
3
|
from fastapi import HTTPException as FastAPIHTTPException
|
4
4
|
from crypticorn.common import ApiError
|
5
5
|
|
6
6
|
|
7
7
|
class ExceptionDetail(BaseModel):
|
8
|
-
message: str
|
9
|
-
error: ApiError
|
8
|
+
message: Optional[str] = Field(None, description="An additional error message")
|
9
|
+
error: ApiError = Field(..., description="The unique error code")
|
10
10
|
|
11
11
|
|
12
12
|
class HTTPException(FastAPIHTTPException):
|
13
|
+
"""A custom HTTP exception wrapper around FastAPI's HTTPException.
|
14
|
+
It allows for a more structured way to handle errors, with a message and an error code. The status code is being derived from the detail's error.
|
15
|
+
The ApiError class is the source of truth for everything. If the error is not yet implemented, there are fallbacks to avoid errors while testing.
|
16
|
+
"""
|
17
|
+
|
13
18
|
def __init__(
|
14
19
|
self,
|
15
|
-
|
16
|
-
detail: ExceptionDetail | str,
|
20
|
+
detail: ExceptionDetail,
|
17
21
|
headers: Optional[Dict[str, str]] = None,
|
18
22
|
):
|
19
|
-
try:
|
20
|
-
exc = (
|
21
|
-
ExceptionDetail(**detail)
|
22
|
-
if not isinstance(detail, ExceptionDetail)
|
23
|
-
else detail
|
24
|
-
)
|
25
|
-
except Exception as e:
|
26
|
-
exc = ExceptionDetail(
|
27
|
-
message=detail,
|
28
|
-
error=ApiError.UNKNOWN_ERROR,
|
29
|
-
)
|
30
|
-
|
31
23
|
super().__init__(
|
32
|
-
status_code=
|
24
|
+
status_code=detail.error.status_code,
|
25
|
+
detail=detail.model_dump(),
|
26
|
+
headers=headers,
|
33
27
|
)
|
@@ -63,7 +63,7 @@ crypticorn/common/__init__.py,sha256=ZR6znFCEMAJH-FuSMga0KaTpAXj3tl9Xz_4Xi820l9w
|
|
63
63
|
crypticorn/common/auth.py,sha256=q5DwgoIzveGWXCHpGl4xMPEABsjufptTqsR92MsOi6M,7618
|
64
64
|
crypticorn/common/enums.py,sha256=6cCwQZVdXUoN33WA8kSf4LeSZyExZcWO2ahSsgGddCs,1243
|
65
65
|
crypticorn/common/errors.py,sha256=LyX32A8Bgl20DrQmeUOPYYp1KIj4uRjvha4VyTFZm0A,20102
|
66
|
-
crypticorn/common/exceptions.py,sha256=
|
66
|
+
crypticorn/common/exceptions.py,sha256=SnvmGDeZfraCWreexKRRQjhXq6JaCZO72SBVwZnqWWo,1065
|
67
67
|
crypticorn/common/pydantic.py,sha256=pmnGYCIrLv59wZkDbvPyK9NJmgPJWW74LXTdIWSjOkY,1063
|
68
68
|
crypticorn/common/scopes.py,sha256=MgH9sGodJfPjEqVtFsaczNmwEaGL2wuGzeTpga_ehXs,2407
|
69
69
|
crypticorn/common/sorter.py,sha256=keRRp4u7KJk3nS2A8tMdSF8Hbc1jcsre8KdTVuetfGc,1278
|
@@ -283,8 +283,8 @@ crypticorn/trade/client/models/tpsl.py,sha256=LlqzHaSA-HgQp1k4PhRckmxWNhgVZU6NgB
|
|
283
283
|
crypticorn/trade/client/models/trading_action_type.py,sha256=oLVDp94VeC9kjYbgZN7dHn2t07YGGUrAkNr2PE435eM,827
|
284
284
|
crypticorn/trade/client/models/validation_error.py,sha256=x4rR325juK4EJiFJ8l5IKp2werY8y6PWbLx_WJMxbbA,3208
|
285
285
|
crypticorn/trade/client/models/validation_error_loc_inner.py,sha256=ZB2NbHkxhjDZ2-qK1HyvzTUnabeCdxeTjbSAHNmWq5A,5111
|
286
|
-
crypticorn-2.5.
|
287
|
-
crypticorn-2.5.
|
288
|
-
crypticorn-2.5.
|
289
|
-
crypticorn-2.5.
|
290
|
-
crypticorn-2.5.
|
286
|
+
crypticorn-2.5.0rc2.dist-info/METADATA,sha256=75YXsZ5HPSAsJgC_vh5IRLjett9-WrbDDLHKulQZv_Y,6210
|
287
|
+
crypticorn-2.5.0rc2.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
288
|
+
crypticorn-2.5.0rc2.dist-info/entry_points.txt,sha256=d_xHsGvUTebPveVUK0SrpDFQ5ZRSjlI7lNCc11sn2PM,59
|
289
|
+
crypticorn-2.5.0rc2.dist-info/top_level.txt,sha256=EP3NY216qIBYfmvGl0L2Zc9ItP0DjGSkiYqd9xJwGcM,11
|
290
|
+
crypticorn-2.5.0rc2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|