Skip to content

Fix(dbt_cli): Add global error handling group for dbt subcommands#5239

Merged
themisvaltinos merged 5 commits intomainfrom
themis/dbttrace
Aug 27, 2025
Merged

Fix(dbt_cli): Add global error handling group for dbt subcommands#5239
themisvaltinos merged 5 commits intomainfrom
themis/dbttrace

Conversation

@themisvaltinos
Copy link
Contributor

Currently the traceback is printed for the sqlmesh_dbt subcommands, this introduces a custom click group subclass that automatically wraps all subcommand callbacks with cli_global_error_handler ensuring error handling across the cli commands like run, list and in case more are added in the future.

@themisvaltinos themisvaltinos requested a review from erindru August 27, 2025 17:57
Copy link
Collaborator

@erindru erindru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is better, i'll adjust my other PR



def test_run_error_handler(jaffle_shop_duckdb: Path, invoke_cli: t.Callable[..., Result]):
with patch("sqlmesh_dbt.operations.DbtOperations.run") as mock_run:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, actually, shouldnt this use pytest's MockerFixture?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right revised to use mockerfixture instead

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. arguably it's less pretty but MockerFixture plays nicely with pytest and helps prevent mocks from clobbering each other between tests

@themisvaltinos themisvaltinos merged commit 54d21eb into main Aug 27, 2025
35 of 37 checks passed
@themisvaltinos themisvaltinos deleted the themis/dbttrace branch August 27, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants