Skip to main content

systemprompt_models/errors/
parse.rs

1//! Parsing-layer error types: enum tag dispatch and config bootstrap.
2
3#[derive(Debug, Clone, thiserror::Error, PartialEq, Eq)]
4#[error("invalid {kind}: {value}")]
5pub struct ParseEnumError {
6    pub kind: &'static str,
7    pub value: String,
8}
9
10impl ParseEnumError {
11    #[must_use]
12    pub fn new(kind: &'static str, value: impl Into<String>) -> Self {
13        Self {
14            kind,
15            value: value.into(),
16        }
17    }
18}
19
20#[derive(Debug, Clone, Copy, thiserror::Error)]
21pub enum ConfigError {
22    #[error("Config not initialized. Call Config::init() first.")]
23    NotInitialized,
24
25    #[error("DATABASE_URL must be a PostgreSQL connection string (postgres:// or postgresql://)")]
26    InvalidPostgresUrl,
27}