Skip to main content

systemprompt_provider_contracts/web_config/
error.rs

1//! Typed error returned by [`crate::web_config::WebConfig`] loading.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use std::path::PathBuf;
7
8use thiserror::Error;
9
10#[derive(Debug, Error)]
11pub enum WebConfigError {
12    #[error("Failed to read web config at '{path}': {source}")]
13    Io {
14        path: String,
15        #[source]
16        source: std::io::Error,
17    },
18
19    #[error("Failed to parse web config: {0}")]
20    Parse(#[from] serde_yaml::Error),
21
22    #[error("Missing required field: {field}")]
23    MissingField { field: String },
24
25    #[error("Invalid value for {field}: {message}")]
26    InvalidValue { field: String, message: String },
27
28    #[error("{field} directory not found: {path}")]
29    PathNotFound { field: String, path: PathBuf },
30}