feat: add structured error types for Tauri IPC commands

Introduces McError and McErrorCode to replace string-based errors in
Tauri commands. This enables the frontend to handle errors programmatically
rather than parsing error messages.

Key design decisions:
- Error codes use SCREAMING_SNAKE_CASE for frontend pattern matching
- Each error indicates whether it's recoverable (user can retry)
- Automatic conversion from LoreError, BeadsError, and BridgeError
- Errors serialize to JSON for consistent IPC transport

Error categories:
- Lore: LORE_UNAVAILABLE, LORE_UNHEALTHY, LORE_FETCH_FAILED
- Bridge: BRIDGE_LOCKED, BRIDGE_MAP_CORRUPTED, BRIDGE_SYNC_FAILED
- Beads: BEADS_UNAVAILABLE, BEADS_CREATE_FAILED, BEADS_CLOSE_FAILED
- General: IO_ERROR, INTERNAL_ERROR

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
teernisse
2026-02-26 09:32:16 -05:00
parent 8c9f66cdee
commit 6eebe082c8
2 changed files with 266 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
//! - br CLI (beads task management)
//! - MC local state (mapping, decisions, settings)
pub mod lore;
pub mod beads;
pub mod bridge;
pub mod lore;
pub mod state;