diff --git a/.changes/unreleased/Under the Hood-20240412-134502.yaml b/.changes/unreleased/Under the Hood-20240412-134502.yaml new file mode 100644 index 00000000000..62d1ebb859b --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240412-134502.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Migrate to using `error_tag` provided by `dbt-common` +time: 2024-04-12T13:45:02.879023-07:00 +custom: + Author: QMalcolm + Issue: "9914" diff --git a/core/dbt/events/types.py b/core/dbt/events/types.py index daf114042e7..01b46cc54bf 100644 --- a/core/dbt/events/types.py +++ b/core/dbt/events/types.py @@ -1,7 +1,7 @@ import json from dbt.constants import MAXIMUM_SEED_SIZE_NAME, PIN_PACKAGE_URL -from dbt_common.ui import warning_tag, line_wrap_message, green, yellow, red +from dbt_common.ui import error_tag, warning_tag, line_wrap_message, green, yellow, red from dbt_common.events.base_types import EventLevel from dbt_common.events.format import ( format_fancy_output_line, @@ -11,11 +11,6 @@ from dbt.events.base_types import WarnLevel, InfoLevel, DebugLevel, ErrorLevel, DynamicLevel -# TODO Move this to dbt_common.ui -def _error_tag(msg: str) -> str: - return f'[{red("ERROR")}]: {msg}' - - # Event codes have prefixes which follow this table # # | Code | Description | @@ -430,7 +425,7 @@ def message(self) -> str: ) if self.level == EventLevel.ERROR.value: - description = _error_tag(description) + description = error_tag(description) elif self.level == EventLevel.WARN.value: description = warning_tag(description) @@ -448,7 +443,7 @@ def message(self) -> str: description += " Run again with `--debug` to see them all." if self.level == EventLevel.ERROR.value: - description = _error_tag(description) + description = error_tag(description) elif self.level == EventLevel.WARN.value: description = warning_tag(description)