diff --git a/src/rod/__init__.py b/src/rod/__init__.py index 2d65e22..a3f3b50 100644 --- a/src/rod/__init__.py +++ b/src/rod/__init__.py @@ -68,9 +68,9 @@ def get_default_logging_level(env_var: str) -> logging.LoggingLevel: return logging.LoggingLevel[os.environ[env_var].upper()] # Raise if the environment variable is set but the logging level is invalid. - except AttributeError: + except AttributeError as exc: msg = f"Invalid logging level defined in {env_var}: '{os.environ[env_var]}'" - raise ValueError(msg) + raise ValueError(msg) from exc # If the environment variable is not set, return the logging level depending # on the installation mode.