瀏覽代碼

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

ogert 5 年之前
父節點
當前提交
f9a723c610
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      cdplib/db_handlers/MongodbHandler.py

+ 1 - 1
cdplib/db_handlers/MongodbHandler.py

@@ -241,7 +241,7 @@ class MongodbHandler:
 
         except Exception as error:
             if len(data) > 1:
-                self._log.warning(('An error occured inserting {} documents into database: {} and collection: {}.').format(len(data.index), self._database_name, collection_name)
+                self._log.warning(('An error occured inserting {} documents into database: {} and collection: {}.').format(len(data.index), 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))