Skip to main content

openapi_ui/
error.rs

1//! Error types for the openapi-ui crate.
2
3use thiserror::Error;
4
5/// Errors that can occur when generating OpenAPI documentation UI.
6#[derive(Error, Debug)]
7pub enum UIError {
8    /// Failed to parse the OpenAPI specification.
9    #[error("Failed to parse OpenAPI specification: {0}")]
10    ParseError(String),
11
12    /// An I/O error occurred (e.g., writing to a file).
13    #[error("IO error: {0}")]
14    IoError(#[from] std::io::Error),
15
16    /// Failed to serialize or deserialize JSON.
17    #[error("JSON serialization error: {0}")]
18    JsonError(#[from] serde_json::Error),
19
20    /// Invalid configuration was provided.
21    #[error("Invalid configuration: {0}")]
22    ConfigError(String),
23}
24
25/// A specialized `Result` type for openapi-ui operations.
26pub type Result<T> = std::result::Result<T, UIError>;