File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,10 @@ class QdrantDatabase:
3131
3232 def __post_init__ (self ):
3333 """Initialize database client"""
34- self .db_client = QdrantClient (host = self .host , port = self .port )
34+ try :
35+ self .db_client = QdrantClient (host = self .host , port = self .port )
36+ except Exception as e :
37+ logger .error (f"Failed to connect at { self .host } :{ self .port } . Error: { e } " )
3538
3639 def _collection_exists (self , collection_name : str ) -> bool :
3740 """Check if the collection in db already exists"""
Original file line number Diff line number Diff line change 33import requests
44from celery import shared_task
55from django .conf import settings
6- from qdrant_client .http .exceptions import UnexpectedResponse
7- from requests .exceptions import ConnectionError as RequestsConnectionError
86
97from chatbotcore .database import QdrantDatabase
108from chatbotcore .doc_loaders import LoaderFromText
@@ -41,18 +39,9 @@ def create_embedding_for_content_task(self, content_id):
4139 db .store_data (zip (response .json (), metadata ))
4240 content .document_status = Content .DocumentStatus .ADDED_TO_VECTOR
4341
44- except RequestsConnectionError as e :
45- # Qdrant connection failure
46- logger .error (f"Qdrant connection error: { str (e )} " )
47- content .document_status = Content .DocumentStatus .FAILURE
48-
49- except UnexpectedResponse as e :
50- # Qdrant server error
51- logger .error (f"Qdrant storage error [{ e .status_code } ]: { e .content } " )
52- content .document_status = Content .DocumentStatus .FAILURE
53-
5442 # NOTE: All exceptions have been handled with except
55- except Exception :
43+ except Exception as e :
44+ logger .error (f"Error:{ str (e )} " )
5645 content .document_status = Content .DocumentStatus .FAILURE
5746 content .save ()
5847
You can’t perform that action at this time.
0 commit comments