Skip to content

tycoon start: catch QuackTokenError in _preflight_checks for a clean CLI error #157

Description

@db-tycoon-stephen

Follow-up from PR #153 review (flagged by @JesuFemi-O on approval).

load_token() now raises QuackTokenError on a malformed token instead of returning None. The call path tycoon start_preflight_checksquack.ensure_token()load_token() has no handler (src/tycoon/commands/start.py:122), so a tampered .tycoon/secrets.yml surfaces as an unhandled traceback rather than a clean CLI error.

The message itself is actionable ("delete the 'quack' entry and rerun"), only the presentation is wrong.

Fix: catch QuackTokenError in _preflight_checks, route the message through error(), and raise typer.Exit(1).

Test note: this is a CLI-surface behavior (exit code + stderr presentation) — cover it at the subprocess test layer, not just in-process Typer tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions