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():
216216 usage = usage ,
217217 message_channels = message_channels ,
218218 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 ,
221221 file_data = request_dict .get ("file_data" , None ),
222222 )
223223 except UnrecoverableException as ex :
Original file line number Diff line number Diff line change @@ -20,10 +20,6 @@ class UserAuthError(UserError):
2020 status_code : int = 403
2121
2222
23- class UnprocessableEntityError (UserError ):
24- status_code : int = 422
25-
26-
2723class RateLimitError (UserError ):
2824 status_code : int = 429
2925
@@ -36,24 +32,18 @@ class ProviderError(BaseError):
3632 status_code : int = 500
3733
3834
39- class GatewayTimeoutError (BaseError ):
40- status_code : int = 504
41-
42-
4335class CatchAllError (BaseError ):
4436 status_code : int = 512
4537
4638
4739def 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 ):
4946 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 )
5747 elif isinstance (e , ingest_errors .RateLimitError ):
5848 return RateLimitError (e )
5949 elif isinstance (e , ingest_errors .QuotaError ):
You can’t perform that action at this time.
0 commit comments