From 6109ef379c7367af32e6bb2de9867f0d6c6a4e5f Mon Sep 17 00:00:00 2001 From: Michelle Ark Date: Mon, 2 Dec 2024 12:45:44 -0500 Subject: [PATCH] Propagate dbt exception raised during jinja compilation --- dbt_common/clients/jinja.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbt_common/clients/jinja.py b/dbt_common/clients/jinja.py index cb136a3..8cc1205 100644 --- a/dbt_common/clients/jinja.py +++ b/dbt_common/clients/jinja.py @@ -46,6 +46,7 @@ MaterializationArgError, JinjaRenderingError, UndefinedCompilationError, + DbtRuntimeError, ) from dbt_common.exceptions.macros import MacroReturn, UndefinedMacroError, CaughtMacroError @@ -534,7 +535,11 @@ def catch_jinja(node: Optional[_NodeProtocol] = None) -> Iterator[None]: except CompilationError as exc: exc.add_node(node) raise + except DbtRuntimeError: + # Propagate dbt exception raised during jinja compilation + raise except Exception as e: + # Raise any non-dbt exceptions as CompilationError raise CompilationError(str(e), node) from e