Skip to main content

allframe_tauri/
error.rs

1//! Tauri-compatible error types
2//!
3//! Tauri commands require errors to implement `Serialize`,
4//! so we use a dedicated error type instead of `anyhow::Error`.
5
6use serde::Serialize;
7
8/// Errors returned by AllFrame Tauri commands
9#[derive(Debug, thiserror::Error, Serialize)]
10pub enum TauriServerError {
11    /// The requested handler was not found in the router
12    #[error("Handler not found: {0}")]
13    HandlerNotFound(String),
14
15    /// Handler execution failed
16    #[error("Execution failed: {0}")]
17    ExecutionFailed(String),
18
19    /// Attempted to call a non-streaming handler as streaming
20    #[error("Not a streaming handler: {0}")]
21    NotStreamingHandler(String),
22}