Skip to content

Commit

Permalink
updated exception handling in init objects
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Oct 8, 2024
1 parent c99382d commit 4cc5fe5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bbconf/config_parser/bedbaseconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit 4cc5fe5

Please sign in to comment.