Skip to content

Consolidate per-command daemon-error enums into shared DaemonToolError#110

Merged
obj-p merged 1 commit intocli-mcp-parityfrom
shared-daemon-error
Apr 15, 2026
Merged

Consolidate per-command daemon-error enums into shared DaemonToolError#110
obj-p merged 1 commit intocli-mcp-parityfrom
shared-daemon-error

Conversation

@obj-p
Copy link
Copy Markdown
Owner

@obj-p obj-p commented Apr 15, 2026

Summary

Every daemon-client command had its own single-case XxxCommandError.daemonError(String) with an identical description implementation — 8 copies of the same enum across ~80 lines. Replaces them with one shared DaemonToolError.

  • Deleted: ElementsCommandError, SwitchCommandError, ConfigureCommandError, TouchCommandError, SimulatorsCommandError, StopCommandError, VariantsCommandError.
  • SnapshotCommandError keeps its two snapshot-specific cases (invalidImageData, noImageContent) but its daemon-error throws now route through DaemonToolError.

Net: +32 / -77 lines. No behavior change — the thrown messages are byte-for-byte identical.

Test plan

  • swift build
  • swift test --filter 'ElementsCommandTests|SwitchCommandTests|ConfigureCommandTests|TouchCommandTests|SimulatorsCommandTests|StopCommandTests|VariantsCommandTests' (41 tests across 7 suites, all green, ~2m)

🤖 Generated with Claude Code

Every daemon-client command had its own single-case
XxxCommandError.daemonError(String) with an identical description
implementation — 8 copies of the same enum across ~80 lines. Replace
them with one shared DaemonToolError in DaemonToolError.swift:

- ElementsCommandError, SwitchCommandError, ConfigureCommandError,
  TouchCommandError, SimulatorsCommandError, StopCommandError,
  VariantsCommandError: deleted. All throw sites now use
  DaemonToolError.daemonError.
- SnapshotCommandError keeps its two snapshot-specific cases
  (invalidImageData, noImageContent). Its daemon-error throws are
  redirected through DaemonToolError.

No behavior change — the thrown messages are byte-for-byte identical
because both enums just surface the daemon's text verbatim. All 41
tests across the 7 daemon-client suites pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@obj-p obj-p merged commit d078cde into cli-mcp-parity Apr 15, 2026
@obj-p obj-p deleted the shared-daemon-error branch April 15, 2026 20:42
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