Skip to content

Commit 1415299

Browse files
authored
Handle errors in the API (#51)
1 parent 4dfb580 commit 1415299

File tree

3 files changed

+631
-629
lines changed

3 files changed

+631
-629
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.30" # pragma: no cover
1+
__version__ = "0.0.31" # pragma: no cover

unstructured_platform_plugins/etl_uvicorn/api_generator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from functools import partial
77
from typing import Any, Callable, Optional, Union
88

9-
from fastapi import FastAPI, status
9+
from fastapi import FastAPI, HTTPException, status
1010
from fastapi.responses import StreamingResponse
1111
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
1212
from pydantic import BaseModel, Field, create_model
@@ -208,6 +208,11 @@ async def _stream_response():
208208
output=output,
209209
file_data=request_dict.get("file_data", None),
210210
)
211+
except HTTPException as exc:
212+
logger.error(
213+
f"HTTPException: {exc.detail} (status_code={exc.status_code})", exc_info=True
214+
)
215+
raise
211216
except UnrecoverableException as ex:
212217
logger.info("Unrecoverable error occurred during plugin invocation")
213218
return InvokeResponse(

0 commit comments

Comments
 (0)