Skip to content

Add an errorMessage(e) helper and replace 24 inline copies #314

Closed

Description

@TMHSDigital

Summary

err instanceof Error ? err.message : String(err) is inlined at 24 sites in 10 files; some use the unsafe (err as Error).message.

Where

  • src/index.ts:34, 46, 113, 123
  • src/cli.ts:228, 311, 484
  • src/setup.ts:229, 335
  • src/utils/sessions.ts:635
  • src/utils/lifecycle.ts:278
  • src/tools/startRecording.ts:448, 470 (as Error casts)
  • src/utils/errors.ts:57 (already does this internally)

Impact

Minor inconsistency; the casts can print undefined for non-Error throws.

Suggested fix

Export errorMessage(e: unknown) from errors.ts and replace the sites mechanically.

Acceptance criteria

  • No inline copies or as Error casts remain

Getting started

  • Relevant files: src/index.ts, src/cli.ts, src/setup.ts, src/utils/sessions.ts, src/utils/lifecycle.ts, src/tools/startRecording.ts
  • How to run tests: npm run build && npm test (also npm run typecheck and npm run lint)
  • Related docs: CONTRIBUTING.md, AGENTS.md

Filed by repo-audit/full-audit at f2fda28. Severity: low. Effort: S. audit-key: tech-debt|src/utils/errors.ts|errorMessage

Activity

  1. added
    good first issue
    priority: low
    tech-debt
    on Nov 9, 2026
  2. TMHSDigital commented on Nov 10, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in eadad60: errorMessage(e) is exported from src/utils/errors.ts (and used by errorResponse); all 40 inline copies and (e as Error).message casts now call it. Verified: build, typecheck, lint, and the full test suite (1071 passed).

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

    good first issuepriority: lowtech-debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions