From 4cc5fe52af912a22a9fb19f34949e1e53ff59bb4 Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Tue, 8 Oct 2024 14:40:30 -0400 Subject: [PATCH] updated exception handling in init objects --- bbconf/config_parser/bedbaseconfig.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bbconf/config_parser/bedbaseconfig.py b/bbconf/config_parser/bedbaseconfig.py index 66a3c1e..3b93b41 100644 --- a/bbconf/config_parser/bedbaseconfig.py +++ b/bbconf/config_parser/bedbaseconfig.py @@ -281,11 +281,16 @@ def _init_boto3_client( warnings.warn(f"Error in creating boto3 client object: {e}", UserWarning) return None - def _init_r2v_object(self) -> Region2VecExModel: + def _init_r2v_object(self) -> Union[Region2VecExModel, None]: """ Create Region2VecExModel object using credentials provided in config file """ - return Region2VecExModel(self.config.path.region2vec) + try: + return Region2VecExModel(self.config.path.region2vec) + except Exception as e: + _LOGGER.error(f"Error in creating Region2VecExModel object: {e}") + warnings.warn(f"Error in creating Region2VecExModel object: {e}", UserWarning) + return None def upload_s3(self, file_path: str, s3_path: Union[Path, str]) -> None: """