Skip to main content

vv_agent/skills/
errors.rs

1#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
2#[error("{message}")]
3pub struct SkillError {
4    pub message: String,
5}
6
7impl SkillError {
8    pub fn new(message: impl Into<String>) -> Self {
9        Self {
10            message: message.into(),
11        }
12    }
13}
14
15impl From<SkillParseError> for SkillError {
16    fn from(error: SkillParseError) -> Self {
17        Self::new(error.to_string())
18    }
19}
20
21impl From<SkillValidationError> for SkillError {
22    fn from(error: SkillValidationError) -> Self {
23        Self::new(error.to_string())
24    }
25}
26
27impl From<std::io::Error> for SkillError {
28    fn from(error: std::io::Error) -> Self {
29        Self::new(error.to_string())
30    }
31}
32
33#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
34#[error("{message}")]
35pub struct SkillParseError {
36    pub message: String,
37}
38
39impl SkillParseError {
40    pub fn new(message: impl Into<String>) -> Self {
41        Self {
42            message: message.into(),
43        }
44    }
45}
46
47#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
48#[error("{message}")]
49pub struct SkillValidationError {
50    pub message: String,
51}
52
53impl SkillValidationError {
54    pub fn new(message: impl Into<String>) -> Self {
55        Self {
56            message: message.into(),
57        }
58    }
59}