Skip to content

Commit 93bce15

Browse files
authored
chore: allow raise HTTPexcpetion with dict as detail msg (#57)
Unstructured-IO/platform-plugins#673 (comment)
1 parent 51c28a3 commit 93bce15

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.35" # pragma: no cover
1+
__version__ = "0.0.36" # pragma: no cover

unstructured_platform_plugins/etl_uvicorn/api_generator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ async def _stream_response():
190190
InvokeResponse(
191191
usage=usage,
192192
message_channels=message_channels,
193-
filedata_meta=filedata_meta_model.model_validate(filedata_meta.model_dump()),
193+
filedata_meta=filedata_meta_model.model_validate(
194+
filedata_meta.model_dump()
195+
),
194196
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
195197
status_code_text=f"[{e.__class__.__name__}] {e}",
196198
).model_dump_json()
@@ -217,7 +219,9 @@ async def _stream_response():
217219
message_channels=message_channels,
218220
filedata_meta=filedata_meta_model.model_validate(filedata_meta.model_dump()),
219221
status_code=exc.status_code,
220-
status_code_text=exc.detail,
222+
status_code_text=json.dumps(exc.detail)
223+
if isinstance(exc.detail, dict)
224+
else exc.detail,
221225
file_data=request_dict.get("file_data", None),
222226
)
223227
except UnrecoverableException as ex:

0 commit comments

Comments
 (0)