Skip to content

Commit

Permalink
Fix handling of indexing error (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
hari-kuriakose authored Apr 9, 2024
1 parent 7ed943d commit aed4fe6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/unstract/sdk/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ def __str__(self) -> str:

class IndexingError(SdkError):
def __init__(self, message: str = ""):
prefix = "Error with indexing. "
super().__init__(prefix + message)
if "404" in message:
message = "Index not found. Please check vector db adapter settings."
super().__init__(message)
2 changes: 1 addition & 1 deletion src/unstract/sdk/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def index_file(
f"Error adding nodes to vector db: {e}",
level=LogLevel.ERROR,
)
raise SdkError(f"Error adding nodes to vector db: {e}")
raise IndexingError(str(e)) from e
self.tool.stream_log("Added nodes to vector db")

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

0 comments on commit aed4fe6

Please sign in to comment.