termux_gui/
error.rs

1//! Error types for Termux GUI
2
3use std::io;
4use thiserror::Error;
5
6/// Result type alias for Termux GUI operations
7pub type Result<T> = std::result::Result<T, GuiError>;
8
9/// Errors that can occur when using Termux GUI
10#[derive(Error, Debug)]
11pub enum GuiError {
12    /// IO error occurred
13    #[error("IO error: {0}")]
14    Io(#[from] io::Error),
15    
16    /// JSON serialization/deserialization error
17    #[error("JSON error: {0}")]
18    Json(#[from] serde_json::Error),
19    
20    /// Socket binding failed
21    #[error("Failed to bind socket: {0}")]
22    SocketBind(String),
23    
24    /// Connection to Termux GUI service failed
25    #[error("Failed to connect to Termux GUI service")]
26    ConnectionFailed,
27    
28    /// Invalid response from GUI service
29    #[error("Invalid response: {0}")]
30    InvalidResponse(String),
31    
32    /// View not found
33    #[error("View with ID {0} not found")]
34    ViewNotFound(i64),
35    
36    /// Invalid view operation
37    #[error("Invalid view operation: {0}")]
38    InvalidOperation(String),
39    
40    /// Event handling error
41    #[error("Event handling error: {0}")]
42    EventError(String),
43}