-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dbt cli get_error() #21999
dbt cli get_error() #21999
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@@ -656,6 +656,45 @@ def is_successful(self) -> bool: | |||
|
|||
return self.process.wait() == 0 | |||
|
|||
@public | |||
def get_error(self) -> Optional[Exception]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps:
def get_error(self) -> Optional[Exception]: | |
def raise_on_error(self) -> NoReturn: |
- Make it raise a
DagsterInvariantException
or something if a user tries to retrieve an error from a successful invocation - Otherwise
raise
instead ofreturn
- Since this function is guaranteed to
NoReturn
, then we should force it consume the entire event stream before return so we give the most verbose error, with error logs parsed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this suggestion except for raising the DagsterInvariantException
. NoReturn is cool but the name to implies a no-op if there's no error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name would also conflict with the current raise_on_error: bool
property
feef73a
to
4c15b0f
Compare
updated to always wait() so we have more context in all error messages
4c15b0f
to
ed0a029
Compare
ed0a029
to
c626576
Compare
When using
dbt.cli(..., raise_on_error=False)
, users may still want to retrieve the error that would have been raised._errors
is private, so they couldn't put this together themselves either.