X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_common%2Fdbmemory.py;h=ad5213573f3d9f32db8bc9ef3f7e1a7eedbcef2b;hb=abe9dced7126c866b751acf560aee085d6d2d69d;hp=d089575ffa9b5666614b9aabe7ba1a1150555411;hpb=2644b76248a1b96f7a47013b414e31b4e3feecf8;p=osm%2Fcommon.git diff --git a/osm_common/dbmemory.py b/osm_common/dbmemory.py index d089575..ad52135 100644 --- a/osm_common/dbmemory.py +++ b/osm_common/dbmemory.py @@ -15,12 +15,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging -from osm_common.dbbase import DbException, DbBase -from osm_common.dbmongo import deep_update +from copy import deepcopy from http import HTTPStatus +import logging from uuid import uuid4 -from copy import deepcopy + +from osm_common.dbbase import DbBase, DbException +from osm_common.dbmongo import deep_update + __author__ = "Alfonso Tierno " @@ -396,16 +398,18 @@ class DbMemory(DbBase): ) del dict_to_update[key_to_update] updated = True - except Exception: - pass + except Exception as unset_error: + self.logger.error(f"{unset_error} occured while updating DB.") if pull: for dot_k, v in pull.items(): try: dict_to_update, key_to_update, _ = _iterate_keys( dot_k, db_item, populate=False ) - except Exception: + except Exception as pull_error: + self.logger.error(f"{pull_error} occured while updating DB.") continue + if key_to_update not in dict_to_update: continue if not isinstance(dict_to_update[key_to_update], list): @@ -428,8 +432,12 @@ class DbMemory(DbBase): dict_to_update, key_to_update, _ = _iterate_keys( dot_k, db_item, populate=False ) - except Exception: + except Exception as iterate_error: + self.logger.error( + f"{iterate_error} occured while iterating keys in db update." + ) continue + if key_to_update not in dict_to_update: continue if not isinstance(dict_to_update[key_to_update], list):