summaryrefslogtreecommitdiff
path: root/makima/daemon/src/error.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-06 04:08:11 +0000
committersoryu <soryu@soryu.co>2026-01-11 03:01:13 +0000
commit8b17a175c3e7e27b789812eba4e3cd760beadb10 (patch)
tree7864dcaa2fa9db47fdfd4e8bfdb0b1dde832aa33 /makima/daemon/src/error.rs
parentf79c416c58557d2f946aa5332989afdfa8c021cd (diff)
downloadsoryu-8b17a175c3e7e27b789812eba4e3cd760beadb10.tar.gz
soryu-8b17a175c3e7e27b789812eba4e3cd760beadb10.zip
Initial Control system
Diffstat (limited to 'makima/daemon/src/error.rs')
-rw-r--r--makima/daemon/src/error.rs75
1 files changed, 75 insertions, 0 deletions
diff --git a/makima/daemon/src/error.rs b/makima/daemon/src/error.rs
new file mode 100644
index 0000000..00e5140
--- /dev/null
+++ b/makima/daemon/src/error.rs
@@ -0,0 +1,75 @@
+//! Error types for the makima daemon.
+
+use thiserror::Error;
+use uuid::Uuid;
+
+/// Top-level daemon error type.
+#[derive(Error, Debug)]
+pub enum DaemonError {
+ #[error("WebSocket error: {0}")]
+ WebSocket(#[from] tokio_tungstenite::tungstenite::Error),
+
+ #[error("Worktree error: {0}")]
+ Worktree(#[from] crate::worktree::WorktreeError),
+
+ #[error("Process error: {0}")]
+ Process(#[from] crate::process::ClaudeProcessError),
+
+ #[error("Task error: {0}")]
+ Task(#[from] TaskError),
+
+ #[error("Configuration error: {0}")]
+ Config(#[from] config::ConfigError),
+
+ #[error("Database error: {0}")]
+ Database(#[from] rusqlite::Error),
+
+ #[error("IO error: {0}")]
+ Io(#[from] std::io::Error),
+
+ #[error("JSON error: {0}")]
+ Json(#[from] serde_json::Error),
+
+ #[error("Authentication failed: {0}")]
+ AuthFailed(String),
+
+ #[error("Connection lost")]
+ ConnectionLost,
+
+ #[error("Server error: {code} - {message}")]
+ ServerError { code: String, message: String },
+}
+
+/// Task management errors.
+#[derive(Error, Debug)]
+pub enum TaskError {
+ #[error("Task not found: {0}")]
+ NotFound(Uuid),
+
+ #[error("Invalid state transition from {from} to {to}")]
+ InvalidStateTransition { from: String, to: String },
+
+ #[error("Concurrency limit reached")]
+ ConcurrencyLimit,
+
+ #[error("Task already exists: {0}")]
+ AlreadyExists(Uuid),
+
+ #[error("Task not running: {0}")]
+ NotRunning(Uuid),
+
+ #[error("Failed to send message to task: {0}")]
+ MessageFailed(String),
+
+ #[error("Task setup failed: {0}")]
+ SetupFailed(String),
+
+ #[error("Task execution failed: {0}")]
+ ExecutionFailed(String),
+}
+
+/// Result type alias for daemon operations.
+pub type Result<T> = std::result::Result<T, DaemonError>;
+
+/// Result type alias for task operations.
+pub type TaskResult<T> = std::result::Result<T, TaskError>;