Skip to content

Commit a3f6a28

Browse files
committed
improve optional dependency error message
1 parent 2035235 commit a3f6a28

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sagemaker/lineage/_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ def get_module(module_name):
4040
"""Import a module.
4141
4242
Args:
43-
module_name (str): N_utiame of the module to importt.
43+
module_name (str): name of the module to import.
4444
4545
Returns:
46-
[obj]: The imported module
46+
[obj]: The imported module.
47+
Raises exceptions when the module name is not found
4748
"""
48-
return import_module(module_name)
49+
try:
50+
return import_module(module_name)
51+
except ImportError:
52+
raise Exception("Cannot import module {}, please try again.".format(module_name))

0 commit comments

Comments
 (0)