From d3072e2d2e821b04b927fc343bbac85015fc45f6 Mon Sep 17 00:00:00 2001 From: efj-amzn Date: Wed, 16 Jul 2025 14:11:56 -0700 Subject: [PATCH] feat(core): update `_import_utils.py` to not mask the thrown exception (#32071) --- libs/core/langchain_core/_import_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/core/langchain_core/_import_utils.py b/libs/core/langchain_core/_import_utils.py index 6c1d99a3f4d..6f4d0a5df2b 100644 --- a/libs/core/langchain_core/_import_utils.py +++ b/libs/core/langchain_core/_import_utils.py @@ -27,8 +27,8 @@ def import_attr( else: try: module = import_module(f".{module_name}", package=package) - except ModuleNotFoundError: - msg = f"module '{package!r}.{module_name!r}' not found" + except ModuleNotFoundError as err: + msg = f"module '{package!r}.{module_name!r}' not found ({err})" raise ImportError(msg) from None result = getattr(module, attr_name) return result