Skip to content

Commit aed4fe6

Browse files
Fix handling of indexing error (#33)
1 parent 7ed943d commit aed4fe6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/unstract/sdk/exceptions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ def __str__(self) -> str:
1212

1313
class IndexingError(SdkError):
1414
def __init__(self, message: str = ""):
15-
prefix = "Error with indexing. "
16-
super().__init__(prefix + message)
15+
if "404" in message:
16+
message = "Index not found. Please check vector db adapter settings."
17+
super().__init__(message)

src/unstract/sdk/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def index_file(
293293
f"Error adding nodes to vector db: {e}",
294294
level=LogLevel.ERROR,
295295
)
296-
raise SdkError(f"Error adding nodes to vector db: {e}")
296+
raise IndexingError(str(e)) from e
297297
self.tool.stream_log("Added nodes to vector db")
298298

299299
self.tool.stream_log("File has been indexed successfully")

0 commit comments

Comments
 (0)