Skip to content

Commit 52e6815

Browse files
remove unnecessary wrap error logic (#60)
wrap_error logic is no longer needed because exceptions are already categorized in unstructured-ingest. more details Unstructured-IO/unstructured-ingest#583
1 parent 83bd4a7 commit 52e6815

File tree

5 files changed

+422
-441
lines changed

5 files changed

+422
-441
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.39
2+
3+
* **Remove wrap_error logic as exceptions are categorized in unstructured-ingest**
4+
15
## 0.0.29
26

37
* **Support persisting file data changes**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.38" # pragma: no cover
1+
__version__ = "0.0.39" # pragma: no cover

unstructured_platform_plugins/etl_uvicorn/api_generator.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from uvicorn.config import LOG_LEVELS
1616
from uvicorn.importer import import_from_string
1717

18-
from unstructured_platform_plugins.etl_uvicorn.errors import wrap_error
1918
from unstructured_platform_plugins.etl_uvicorn.otel import get_metric_provider, get_trace_provider
2019
from unstructured_platform_plugins.etl_uvicorn.utils import (
2120
get_func,
@@ -185,15 +184,16 @@ async def _stream_response():
185184
)
186185
except Exception as e:
187186
logger.error(f"Failure streaming response: {e}", exc_info=True)
188-
http_error = wrap_error(e)
189187
yield (
190188
InvokeResponse(
191189
usage=usage,
192190
message_channels=message_channels,
193191
filedata_meta=filedata_meta_model.model_validate(
194192
filedata_meta.model_dump()
195193
),
196-
status_code=http_error.status_code,
194+
status_code=e.status_code
195+
if hasattr(e, "status_code")
196+
else status.HTTP_500_INTERNAL_SERVER_ERROR,
197197
status_code_text=f"[{e.__class__.__name__}] {e}",
198198
).model_dump_json()
199199
+ "\n"
@@ -226,12 +226,13 @@ async def _stream_response():
226226
)
227227
except Exception as invoke_error:
228228
logger.error(f"failed to invoke plugin: {invoke_error}", exc_info=True)
229-
http_error = wrap_error(invoke_error)
230229
return InvokeResponse(
231230
usage=usage,
232231
message_channels=message_channels,
233232
filedata_meta=filedata_meta_model.model_validate(filedata_meta.model_dump()),
234-
status_code=http_error.status_code,
233+
status_code=invoke_error.status_code
234+
if hasattr(invoke_error, "status_code")
235+
else status.HTTP_500_INTERNAL_SERVER_ERROR,
235236
status_code_text=f"[{invoke_error.__class__.__name__}] {invoke_error}",
236237
file_data=request_dict.get("file_data", None),
237238
)

unstructured_platform_plugins/etl_uvicorn/errors.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)