fluers_core/error.rs
1//! Error types for the core crate.
2
3use thiserror::Error;
4
5/// A specialized [`Result`] for `fluers-core` operations.
6pub type Result<T> = std::result::Result<T, CoreError>;
7
8/// Errors raised by the core agent/model layer.
9#[derive(Debug, Error)]
10pub enum CoreError {
11 /// A tool call referenced an unknown tool.
12 #[error("unknown tool: {0}")]
13 UnknownTool(String),
14
15 /// Tool input failed JSON-schema validation.
16 #[error("tool input validation failed: {0}")]
17 ToolInputValidation(String),
18
19 /// Tool output failed to serialize or validate.
20 #[error("tool output invalid: {0}")]
21 ToolOutput(String),
22
23 /// The model provider rejected the request.
24 #[error("model provider error: {0}")]
25 ModelProvider(String),
26
27 /// The model response could not be parsed.
28 #[error("model response parse error: {0}")]
29 ModelResponse(String),
30
31 /// An I/O or transport error talking to a provider.
32 #[error("transport error: {0}")]
33 Transport(String),
34
35 /// A caller cancelled the operation (e.g. deadline elapsed).
36 #[error("operation cancelled: {0}")]
37 Cancelled(String),
38}