systemprompt_models/errors/
validation.rs1#[derive(Debug, Clone, thiserror::Error)]
5pub enum ConfigValidationError {
6 #[error("{0}")]
7 Required(String),
8
9 #[error("{0}")]
10 InvalidField(String),
11
12 #[error("{0}")]
13 PortConflict(String),
14
15 #[error("{0}")]
16 UnknownReference(String),
17
18 #[error("{0}")]
19 CircularDependency(String),
20
21 #[error("{0}")]
22 BusinessRule(String),
23}
24
25impl ConfigValidationError {
26 #[must_use]
27 pub fn required(msg: impl Into<String>) -> Self {
28 Self::Required(msg.into())
29 }
30
31 #[must_use]
32 pub fn invalid_field(msg: impl Into<String>) -> Self {
33 Self::InvalidField(msg.into())
34 }
35
36 #[must_use]
37 pub fn port_conflict(msg: impl Into<String>) -> Self {
38 Self::PortConflict(msg.into())
39 }
40
41 #[must_use]
42 pub fn unknown_reference(msg: impl Into<String>) -> Self {
43 Self::UnknownReference(msg.into())
44 }
45
46 #[must_use]
47 pub fn circular_dependency(msg: impl Into<String>) -> Self {
48 Self::CircularDependency(msg.into())
49 }
50
51 #[must_use]
52 pub fn business_rule(msg: impl Into<String>) -> Self {
53 Self::BusinessRule(msg.into())
54 }
55}