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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

treysp
Copy link
Contributor

@treysp treysp commented Jan 24, 2025

TODO

  • Check error object structure for all engines
  • Validate Github CI/CD output
  • Validate formatting for cloud engines

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:
    • Do layout formatting early
    • Do color 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. Pass error up exception chain:
    • Creates new error class PlanApplyError to differentiate the errors we format carefully from others that we bubble up as normal
    • Creates new error class PythonModelEvalError to differentiate from SQL eval errors

Engine peculiarities

  • MSSQL returns an error object with two args: int error code, bytes error message

@treysp treysp force-pushed the trey/cli-errors branch 6 times, most recently from 9297057 to 14ee633 Compare January 25, 2025 03:24
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