Skip to content

Commit c2b9593

Browse files
authored
Add UnrecoverableException exception handling back (#29)
1 parent 19e8cfa commit c2b9593

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
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.11
2+
3+
* **Bugfix: Add UnrecoverableException exception handling back**
4+
15
## 0.0.10
26

37
* **Bugfix: Add `None` support in mapping `FileDataMeta` response**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.10" # pragma: no cover
1+
__version__ = "0.0.11" # pragma: no cover

unstructured_platform_plugins/etl_uvicorn/api_generator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
get_schema_dict,
2525
map_inputs,
2626
)
27+
from unstructured_platform_plugins.exceptions import UnrecoverableException
2728
from unstructured_platform_plugins.schema import FileDataMeta, NewRecord, UsageData
2829
from unstructured_platform_plugins.schema.json_schema import (
2930
schema_to_base_model,
@@ -158,6 +159,9 @@ async def _stream_response():
158159
status_code=status.HTTP_200_OK,
159160
output=output,
160161
)
162+
except UnrecoverableException as ex:
163+
logger.info("Unrecoverable error occurred during plugin invocation")
164+
return InvokeResponse(usage=usage, status_code=512, status_code_text=ex.message)
161165
except Exception as invoke_error:
162166
logger.error(f"failed to invoke plugin: {invoke_error}", exc_info=True)
163167
return InvokeResponse(

0 commit comments

Comments
 (0)