Skip to content

fix: clean error messages for expected API and OAuth failures#41

Merged
jdwit merged 2 commits into
mainfrom
fix/clean-error-messages
Jun 18, 2026
Merged

fix: clean error messages for expected API and OAuth failures#41
jdwit merged 2 commits into
mainfrom
fix/clean-error-messages

Conversation

@jdwit

@jdwit jdwit commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Closes #38

Problem

Expected, user-facing failures dumped a full Rich traceback: any non-403 HttpError (e.g. a 400 from analytics query with an unaligned date range) and OAuth denial during ytstudio login.

Fix

  • handle_api_error keeps re-raising unknown errors so command-specific handlers (comments, livestreams) can still add context.
  • New CLI error boundary main.cli (now the ytstudio/yts entry point) turns any HttpError/OAuth2Error that reaches the top into a single clean line + exit 1. Unexpected exceptions keep their traceback.
  • _authenticate_local_server catches AccessDeniedError/OAuth2Error during login with a friendly hint.

Tests

Added coverage for the boundary (clean message, no traceback) and OAuth denial. Full suite: 287 passed, ruff clean.

handle_api_error keeps re-raising unknown errors so command-specific
handlers can add context. A new CLI boundary (main.cli) turns any
HttpError/OAuth2Error that reaches the top into a single clean line,
and _authenticate_local_server catches OAuth denial during login.

Closes #38
@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.81%. Comparing base (64090a0) to head (2ff235a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #41      +/-   ##
==========================================
+ Coverage   83.60%   83.81%   +0.21%     
==========================================
  Files          15       15              
  Lines        2427     2447      +20     
  Branches      356      354       -2     
==========================================
+ Hits         2029     2051      +22     
+ Misses        265      264       -1     
+ Partials      133      132       -1     

☔ 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.

@jdwit jdwit merged commit 8fa621a into main Jun 18, 2026
8 checks passed
@jdwit jdwit deleted the fix/clean-error-messages branch June 18, 2026 08: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.

Raw tracebacks leak on expected API/OAuth errors

2 participants