Skip to content

Narrow the two blind except Exception handlers #70

Description

@tschm

Subcategory: Error handling & API UX (+ linting)
Score: error handling 7 → 10

Both sites are deliberate best-effort degradations that log a warning and continue — the intent is right. The problem is that except Exception also swallows genuine bugs (typos, attribute errors) in the same block, turning them into a silent warning.

What to change

  • src/pycharting/api/interface.py:252 — around webbrowser.open(chart_url); narrow to webbrowser.Error (add OSError if needed)
  • src/pycharting/core/server.py:141 — around app.mount(... StaticFiles ...); narrow to OSError / RuntimeError

done when

ruff reports no BLE001 and both handlers name specific exception types while keeping the existing warn-and-continue behaviour.

Evidence

BLE001 Do not catch blind exception: `Exception`
   --> src/pycharting/api/interface.py:252:20

Surfaced by the Rhiza quality gates during the template bump to jebel-quant/rhiza@v1.2.2, which enabled the stricter ruff rule families (ANN, A, BLE, ARG) and TYPECHECKER=both. Gate status at time of filing: make fmt FAIL, make typecheck FAIL, make docs-coverage FAIL, test-layout FAIL; make deptry, make security, make test PASS (154 tests, 100% coverage).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions