1use std::path::PathBuf;
5
6#[derive(Debug, thiserror::Error)]
7pub enum JoyError {
8 #[error("project already initialized at {0}")]
9 AlreadyInitialized(PathBuf),
10
11 #[error("no Joy project found (run `joy init` first)")]
12 NotInitialized,
13
14 #[error("item not found: {0}")]
15 ItemNotFound(String),
16
17 #[error("milestone not found: {0}")]
18 MilestoneNotFound(String),
19
20 #[error("circular dependency detected: {0}")]
21 CircularDependency(String),
22
23 #[error("failed to create directory {path}")]
24 CreateDir {
25 path: PathBuf,
26 source: std::io::Error,
27 },
28
29 #[error("failed to write {path}")]
30 WriteFile {
31 path: PathBuf,
32 source: std::io::Error,
33 },
34
35 #[error("failed to read {path}")]
36 ReadFile {
37 path: PathBuf,
38 source: std::io::Error,
39 },
40
41 #[error("{path}: {source}")]
42 YamlParse {
43 path: PathBuf,
44 source: serde_yaml_ng::Error,
45 },
46
47 #[error("YAML error: {0}")]
48 Yaml(#[from] serde_yaml_ng::Error),
49
50 #[error("git error: {0}")]
51 Git(String),
52
53 #[error("template error: {0}")]
54 Template(String),
55
56 #[error("authentication failed: {0}")]
57 AuthFailed(String),
58
59 #[error("crypto error: {0}")]
60 Crypto(#[from] joy_crypt::Error),
61
62 #[error("no access to zone '{zone}': ask a member with access to run `joy crypt grant`")]
63 ZoneAccessDenied { zone: String },
64
65 #[error("passphrase too short (minimum 3 words)")]
66 PassphraseTooShort,
67
68 #[error("guard denied: {0}")]
69 GuardDenied(String),
70
71 #[error("{0}")]
72 Other(String),
73}