Skip to content

🎨 Palette: Enhance anyhow nested error formatting in CLI#169

Merged
ffalcinelli merged 1 commit into
mainfrom
ux/anyhow-nested-errors-17220000211048694230
Jul 18, 2026
Merged

🎨 Palette: Enhance anyhow nested error formatting in CLI#169
ffalcinelli merged 1 commit into
mainfrom
ux/anyhow-nested-errors-17220000211048694230

Conversation

@ffalcinelli

Copy link
Copy Markdown
Owner

🎨 Palette: [Improve anyhow error formatting]

πŸ’‘ What:
Updated src/main.rs to stop returning anyhow::Result<()> and instead return std::process::ExitCode. By doing this, we gain control over the Err match, allowing us to manually iterate through anyhow::Error::chain() using .enumerate().

🎯 Why:
By default, anyhow's Debug output for chained errors looks like a raw list:

Login failed

Caused by:
    0: Failed to send login request
    1: client error
    2: tcp connect error

Which is unintuitive for end users. The new format is much cleaner.

πŸ“Έ Before/After:
Before:

Error: Login failed

Caused by:
    0: Failed to send login request
    1: client error
    2: tcp connect error
    3: Connection refused (os error 111)

After:

❌ Error:
  Login failed
    ↳ Failed to send login request
    ↳ client error
    ↳ tcp connect error
    ↳ Connection refused (os error 111)

β™Ώ Ergonomics:
Errors are printed directly to stderr with appropriate ANSI color styling (via the console crate), improving readability while maintaining Unix piping standards. Evaluates strictly to ExitCode::FAILURE (1) upon error.


PR created automatically by Jules for task 17220000211048694230 started by @ffalcinelli

Improved the CLI user experience by returning `std::process::ExitCode` from `main()` and manually iterating over the `anyhow::Error::chain()`. This replaces anyhow's default debug representation, which prints unstyled numbered lists for root causes, with a cleanly styled, red-bolded top-level error and indented (`↳`) nested causes.

Co-authored-by: ffalcinelli <1167082+ffalcinelli@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 96.01%. Comparing base (9777c21) to head (2ef12ae).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #169   +/-   ##
=======================================
  Coverage   96.01%   96.01%           
=======================================
  Files          29       29           
  Lines        2834     2834           
=======================================
  Hits         2721     2721           
  Misses        113      113           

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ffalcinelli
ffalcinelli merged commit d1a1c7d into main Jul 18, 2026
10 checks passed
@ffalcinelli
ffalcinelli deleted the ux/anyhow-nested-errors-17220000211048694230 branch July 18, 2026 07:03
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.

1 participant