Skip to content

Commit 321119c

Browse files
committed
status could be None
1 parent 52e6815 commit 321119c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

unstructured_platform_plugins/etl_uvicorn/api_generator.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,8 @@ async def _stream_response():
191191
filedata_meta=filedata_meta_model.model_validate(
192192
filedata_meta.model_dump()
193193
),
194-
status_code=e.status_code
195-
if hasattr(e, "status_code")
196-
else status.HTTP_500_INTERNAL_SERVER_ERROR,
194+
status_code=getattr(e, "status_code", None)
195+
or status.HTTP_500_INTERNAL_SERVER_ERROR,
197196
status_code_text=f"[{e.__class__.__name__}] {e}",
198197
).model_dump_json()
199198
+ "\n"
@@ -230,9 +229,8 @@ async def _stream_response():
230229
usage=usage,
231230
message_channels=message_channels,
232231
filedata_meta=filedata_meta_model.model_validate(filedata_meta.model_dump()),
233-
status_code=invoke_error.status_code
234-
if hasattr(invoke_error, "status_code")
235-
else status.HTTP_500_INTERNAL_SERVER_ERROR,
232+
status_code=getattr(invoke_error, "status_code", None)
233+
or status.HTTP_500_INTERNAL_SERVER_ERROR,
236234
status_code_text=f"[{invoke_error.__class__.__name__}] {invoke_error}",
237235
file_data=request_dict.get("file_data", None),
238236
)

0 commit comments

Comments
 (0)