diff --git a/core/dbt/config/project.py b/core/dbt/config/project.py index 42bab656dca..79c5a1e881c 100644 --- a/core/dbt/config/project.py +++ b/core/dbt/config/project.py @@ -26,8 +26,8 @@ from dbt.clients.yaml_helper import load_yaml_text from dbt.adapters.contracts.connection import QueryComment from dbt.exceptions import ( - DbtConfigError, DbtProjectError, + DbtWarnErrorOptionsError, ProjectContractBrokenError, ProjectContractError, DbtRuntimeError, @@ -846,7 +846,7 @@ def read_project_flags(project_dir: str, profiles_dir: str) -> ProjectFlags: ProjectFlags.validate(project_flags) return ProjectFlags.from_dict(project_flags) - except (DbtProjectError, DbtConfigError) as exc: + except (DbtProjectError, DbtWarnErrorOptionsError) as exc: # We don't want to eat the DbtProjectError for UserConfig to ProjectFlags or # DbtConfigError for warn_error_options munging raise exc diff --git a/core/dbt/config/utils.py b/core/dbt/config/utils.py index daeac6bed40..0bd9f1eb6a5 100644 --- a/core/dbt/config/utils.py +++ b/core/dbt/config/utils.py @@ -4,8 +4,8 @@ from dbt.clients import yaml_helper from dbt_common.events.functions import fire_event from dbt.events.types import InvalidOptionYAML -from dbt.exceptions import OptionNotYamlDictError -from dbt_common.exceptions import DbtConfigError, DbtValidationError +from dbt.exceptions import DbtWarnErrorOptionsError, OptionNotYamlDictError +from dbt_common.exceptions import DbtValidationError def parse_cli_vars(var_string: str) -> Dict[str, Any]: @@ -39,7 +39,7 @@ def exclusive_primary_alt_value_setting( alt_options = dictionary.get(alt) if primary_options and alt_options: - raise DbtConfigError( + raise DbtWarnErrorOptionsError( f"Only `{alt}` or `{primary}` can be specified in `warn_error_options`, not both" ) diff --git a/core/dbt/exceptions.py b/core/dbt/exceptions.py index eb4d0b97276..a692fad5389 100644 --- a/core/dbt/exceptions.py +++ b/core/dbt/exceptions.py @@ -113,6 +113,10 @@ class DbtProfileError(DbtConfigError): pass +class DbtWarnErrorOptionsError(DbtConfigError): + pass + + class InvalidSelectorError(DbtRuntimeError): def __init__(self, name: str) -> None: self.name = name