-
Notifications
You must be signed in to change notification settings - Fork 3
chore: throw UnstructuredIngestError correctly in plugins #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.0.40" # pragma: no cover | ||
| __version__ = "0.0.41" # pragma: no cover |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,8 @@ | |||||
| from pydantic import BaseModel, Field, create_model | ||||||
| from starlette.responses import RedirectResponse | ||||||
| from unstructured_ingest.data_types.file_data import BatchFileData, FileData, file_data_from_dict | ||||||
| from unstructured_ingest.error import UnstructuredIngestError | ||||||
| from unstructured_ingest.errors_v2 import UnstructuredIngestError as UnstructuredIngestErrorV2 | ||||||
|
||||||
| from uvicorn.config import LOG_LEVELS | ||||||
| from uvicorn.importer import import_from_string | ||||||
|
|
||||||
|
|
@@ -223,6 +225,19 @@ async def _stream_response(): | |||||
| else exc.detail, | ||||||
| file_data=request_dict.get("file_data", None), | ||||||
| ) | ||||||
| except (UnstructuredIngestError, UnstructuredIngestErrorV2) as exc: | ||||||
| logger.error( | ||||||
| f"UnstructuredIngestError: {str(exc)} (status_code={exc.status_code})", | ||||||
|
||||||
| f"UnstructuredIngestError: {str(exc)} (status_code={exc.status_code})", | |
| f"{exc.__class__.__name__}: {str(exc)} (status_code={exc.status_code})", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2 removed so should be fine here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The string literal is split across lines unnecessarily. Consider keeping the error message on a single line for better readability, or if line length is a concern, use implicit string concatenation or a shorter variable name.