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

Feat: improve CLI node evaluation error display #3706

Merged
merged 6 commits into from
Jan 30, 2025
Merged

Conversation

treysp
Copy link
Contributor

@treysp treysp commented Jan 24, 2025

CLI currently prints duplicate/unnecessary error information when a a node evaluation error occurs.

This PR removes the duplication, the unnecessary information, and improves error message formatting.

Background

We currently use multiple approaches to print errors to CLI:

  1. console.log_error() is a method we defined to print red text to CLI
  2. logger.error() is a standard method that prints to both CLI output and log
  3. Standard Python error printing with raise and/or use of Click.ClickException()

Calls to these are spread out, can be duplicative, and do not format the displayed error.

Changes

This PR resolves this by separating these three actions:

  1. Print only formatted errors to CLI:
    • All formatting in console methods log_failed_models() and log_skipped_models()
  2. Print full error traceback to logger: logger.info() so it doesn't also print to CLI
  3. Creates new error class PythonModelEvalError to differentiate from SQL eval errors

@treysp treysp force-pushed the trey/cli-errors branch 7 times, most recently from 14ee633 to e36468d Compare January 25, 2025 16:38
@treysp treysp force-pushed the trey/cli-errors branch 2 times, most recently from bb30698 to 26f6abb Compare January 28, 2025 22:24
@treysp treysp force-pushed the trey/cli-errors branch 2 times, most recently from 6ff9e76 to 71dcde4 Compare January 29, 2025 22:19
@treysp treysp marked this pull request as ready for review January 29, 2025 23:50
@treysp treysp enabled auto-merge (squash) January 30, 2025 00:42
@treysp treysp merged commit 61d59b8 into main Jan 30, 2025
21 checks passed
@treysp treysp deleted the trey/cli-errors branch January 30, 2025 00:51
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