Skip to content

Commit

Permalink
Migrate to error_tag from dbt-common and drop custom _error_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
QMalcolm committed Apr 12, 2024
1 parent 999f7ad commit 449e048
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20240412-134502.yaml
Original file line number Diff line number Diff line change
@@ -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"
11 changes: 3 additions & 8 deletions core/dbt/events/types.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 |
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down

0 comments on commit 449e048

Please sign in to comment.