Skip to main content

systemprompt_models/config/
paths.rs

1#[derive(Debug, Clone)]
2pub struct PathNotConfiguredError {
3    pub path_name: String,
4    pub profile_path: Option<String>,
5}
6
7impl PathNotConfiguredError {
8    pub fn new(path_name: impl Into<String>) -> Self {
9        Self {
10            path_name: path_name.into(),
11            profile_path: None,
12        }
13    }
14
15    pub fn with_profile_path(mut self, profile_path: impl Into<String>) -> Self {
16        self.profile_path = Some(profile_path.into());
17        self
18    }
19}
20
21impl std::fmt::Display for PathNotConfiguredError {
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23        writeln!(f, "Profile Error: Required path not configured\n")?;
24        writeln!(f, "  Field: paths.{}", self.path_name)?;
25        if let Some(ref profile) = self.profile_path {
26            writeln!(f, "  Profile: {}", profile)?;
27        }
28        writeln!(f, "\n  To fix:")?;
29        writeln!(
30            f,
31            "  - Run 'systemprompt cloud config' to regenerate profile"
32        )?;
33        write!(
34            f,
35            "  - Or manually add paths.{} to your profile",
36            self.path_name
37        )
38    }
39}
40
41impl std::error::Error for PathNotConfiguredError {}