Skip to main content

hindsight_copilot/
error.rs

1// Copyright (c) 2026 - present Nicholas D. Crosbie
2// SPDX-License-Identifier: MIT
3
4//! Error types for hindsight-copilot
5
6use thiserror::Error;
7
8/// Errors that can occur during Copilot log processing
9#[derive(Debug, Error)]
10pub enum CopilotError {
11    /// Error parsing JSON
12    #[error("JSON parse error: {0}")]
13    JsonParse(#[from] serde_json::Error),
14
15    /// Error reading log file
16    #[error("IO error: {0}")]
17    Io(#[from] std::io::Error),
18
19    /// Invalid LSP message format
20    #[error("Invalid LSP message: {message}")]
21    InvalidLspMessage {
22        /// Description of why the LSP message was invalid
23        message: String,
24    },
25
26    /// Workspace storage not found
27    #[error("Workspace storage not found: {path}")]
28    WorkspaceStorageNotFound {
29        /// The path that was searched for workspace storage
30        path: String,
31    },
32
33    /// Chat session not found
34    #[error("Chat session not found: {session_id}")]
35    SessionNotFound {
36        /// The session ID that could not be found
37        session_id: String,
38    },
39}