소스 검색

Adding exception handling for when inserting many documents when some of them are invalid

ogert 5 년 전
부모
커밋
542fadab4b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      cdplib/db_handlers/MongodbHandler.py

+ 1 - 1
cdplib/db_handlers/MongodbHandler.py

@@ -244,7 +244,7 @@ class MongodbHandler:
                 self._log.warning(('An error occured inserting {} documents into database: {} and collection: {}.').format(len(data), self._database_name, collection_name))
                 self._log.warning('This might be because one or more documents are invalid.') 
                 self._log.warning('We will try to insert the documents one-by-one and report which are invalid.')
-                self._log.warning('Error: {}').format(error)
+                self._log.warning(('Error: {}').format(error))
                 for row in data:
                     try:
                         self._database[collection_name].insert_one(row)