File tree Expand file tree Collapse file tree 3 files changed +9
-19
lines changed
unstructured_platform_plugins Expand file tree Collapse file tree 3 files changed +9
-19
lines changed Original file line number Diff line number Diff line change 1
- __version__ = "0.0.33 " # pragma: no cover
1
+ __version__ = "0.0.34 " # pragma: no cover
Original file line number Diff line number Diff line change @@ -216,8 +216,8 @@ async def _stream_response():
216
216
usage = usage ,
217
217
message_channels = message_channels ,
218
218
filedata_meta = filedata_meta_model .model_validate (filedata_meta .model_dump ()),
219
- status_code = wrap_error ( exc ) .status_code ,
220
- status_code_text = f"[ { exc .__class__ . __name__ } ] { exc } " ,
219
+ status_code = exc .status_code ,
220
+ status_code_text = exc .detail ,
221
221
file_data = request_dict .get ("file_data" , None ),
222
222
)
223
223
except UnrecoverableException as ex :
Original file line number Diff line number Diff line change @@ -20,10 +20,6 @@ class UserAuthError(UserError):
20
20
status_code : int = 403
21
21
22
22
23
- class UnprocessableEntityError (UserError ):
24
- status_code : int = 422
25
-
26
-
27
23
class RateLimitError (UserError ):
28
24
status_code : int = 429
29
25
@@ -36,24 +32,18 @@ class ProviderError(BaseError):
36
32
status_code : int = 500
37
33
38
34
39
- class GatewayTimeoutError (BaseError ):
40
- status_code : int = 504
41
-
42
-
43
35
class CatchAllError (BaseError ):
44
36
status_code : int = 512
45
37
46
38
47
39
def wrap_error (e : Exception ) -> HTTPException :
48
- if isinstance (e , ingest_errors .UserAuthError ):
40
+ """
41
+ Wraps an exception in a HTTPException.
42
+ """
43
+ if isinstance (e , HTTPException ):
44
+ return e
45
+ elif isinstance (e , ingest_errors .UserAuthError ):
49
46
return UserAuthError (e )
50
- elif isinstance (e , HTTPException ):
51
- if e .status_code == 400 :
52
- return UserError (e )
53
- if e .status_code == 422 :
54
- return UnprocessableEntityError (e )
55
- if e .status_code == 504 :
56
- return GatewayTimeoutError (e )
57
47
elif isinstance (e , ingest_errors .RateLimitError ):
58
48
return RateLimitError (e )
59
49
elif isinstance (e , ingest_errors .QuotaError ):
You can’t perform that action at this time.
0 commit comments