Skip to content

Commit d2c77bd

Browse files
committed
refactor: improve error handling in getCollectionInfo method
1 parent 7efe521 commit d2c77bd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/services/code-index/vector-store/qdrant-client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ export class QdrantVectorStore implements IVectorStore {
4040
private async getCollectionInfo(): Promise<Schemas["CollectionInfo"] | null> {
4141
try {
4242
const collectionInfo = await this.client.getCollection(this.collectionName)
43-
return collectionInfo // Success
44-
} catch (error: any) {
45-
// Log a warning if the error is not a typical 404 "Not Found"
46-
if (error?.response?.status !== 404) {
43+
return collectionInfo
44+
} catch (error: unknown) {
45+
if (error instanceof Error) {
4746
console.warn(
4847
`[QdrantVectorStore] Warning during getCollectionInfo for "${this.collectionName}". Collection may not exist or another error occurred:`,
49-
error?.message || error, // Log error message or the error itself
48+
error.message,
5049
)
5150
}
52-
return null // Treat any error as "collection info not retrievable"
51+
return null
5352
}
5453
}
5554

0 commit comments

Comments
 (0)