Skip to content
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's CLI errors don't play nicely with rich-click dbt ... #141

Closed
dwreeves opened this issue Oct 30, 2023 · 0 comments · Fixed by #143
Closed

dbt's CLI errors don't play nicely with rich-click dbt ... #141

dwreeves opened this issue Oct 30, 2023 · 0 comments · Fixed by #143
Assignees

Comments

@dwreeves
Copy link
Collaborator

Example when wrapping the dbt CLI.

I ran rich-click dbt compile and hit an error, which then raised a separate error that couldn't be parsed.

The issue appears to be that they are subclassing ClickException but they don't set the message attribute. I wonder if there is a way to resolve this more safely.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../python3.11/site-packages/rich_click/rich_command.py", line 126, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/dbt/cli/main.py", line 155, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/dbt/cli/requires.py", line 93, in wrapper
    raise ExceptionExit(e)
dbt.cli.exceptions.ExceptionExit: <exception str() failed>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dreeves/Projects/battery-data/venv_dbt/bin/rich-click", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File ".../python3.11/site-packages/rich_click/cli.py", line 141, in main
    return function()
           ^^^^^^^^^^
  File ".../python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/rich_click/rich_command.py", line 141, in main
    rich_format_error(e, self.formatter)
  File ".../python3.11/site-packages/rich_click/rich_click.py", line 782, in rich_format_error
    highlighter(self.format_message()),
                ^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/exceptions.py", line 35, in format_message
    return self.message
           ^^^^^^^^^^^^
AttributeError: 'ExceptionExit' object has no attribute 'message'
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 a pull request may close this issue.

1 participant