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("Path must be absolute for a remote-execution profile: {}", path.display())]
18    NotAbsolute { path: PathBuf, field: &'static str },
19
20    #[error("Failed to canonicalize path {}: {source}", path.display())]
21    CanonicalizeFailed {
22        path: PathBuf,
23        field: &'static str,
24        #[source]
25        source: std::io::Error,
26    },
27
28    #[error("Binary not found: {name} (searched: {searched:?})")]
29    BinaryNotFound {
30        name: String,
31        searched: Vec<PathBuf>,
32    },
33
34    #[error("Failed to resolve the running executable: {source}")]
35    CurrentExeUnavailable {
36        #[source]
37        source: std::io::Error,
38    },
39}