Skip to content

Commit 470c6cb

Browse files
committed
opt: remove redundant dbt parse err msg
1 parent 9b34ce8 commit 470c6cb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/dbt_score/dbt_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ class DbtNotInstalledException(Exception):
2121
class DbtParseException(Exception):
2222
"""Raised when dbt parse fails."""
2323

24-
def __init__(self, message: str, root_cause: Any | None = None):
24+
def __init__(self, root_cause: Any | None = None):
2525
"""Initialize the exception."""
26-
super().__init__(message)
26+
super().__init__()
2727
self.root_cause = root_cause
2828

2929
def __str__(self) -> str:
3030
"""Return a string representation of the exception."""
3131
if self.root_cause:
32-
return f"{self.args[0]}\n\nRoot cause: {self.root_cause!s}"
33-
return str(self.args[0])
32+
return f"\n\nRoot cause: {self.root_cause!s}"
33+
34+
return "Root cause not found. Please run `dbt parse` manually."
3435

3536

3637
class DbtLsException(Exception):
@@ -72,7 +73,7 @@ def dbt_parse() -> "dbtRunnerResult":
7273
result: "dbtRunnerResult" = dbtRunner().invoke(["parse"])
7374

7475
if not result.success:
75-
raise DbtParseException("dbt parse failed.", root_cause=result.exception)
76+
raise DbtParseException(root_cause=result.exception)
7677

7778
return result
7879

0 commit comments

Comments
 (0)