Skip to main content

systemprompt_models/paths/
error.rs

1//! Path-resolution error types.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use std::path::PathBuf;
7use thiserror::Error;
8
9#[derive(Debug, Error)]
10pub enum PathError {
11    #[error("Required path not configured: {field}")]
12    NotConfigured { field: &'static str },
13
14    #[error("Path does not exist: {}", path.display())]
15    NotFound { path: PathBuf, field: &'static str },
16
17    #[error("Failed to canonicalize path {}: {source}", path.display())]
18    CanonicalizeFailed {
19        path: PathBuf,
20        field: &'static str,
21        #[source]
22        source: std::io::Error,
23    },
24
25    #[error("Binary not found: {name} (searched: {searched:?})")]
26    BinaryNotFound {
27        name: String,
28        searched: Vec<PathBuf>,
29    },
30
31    #[error("Failed to resolve the running executable: {source}")]
32    CurrentExeUnavailable {
33        #[source]
34        source: std::io::Error,
35    },
36}