1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use std::path::PathBuf;
use thiserror::Error;
use super::{IdentityName, UnknownAuthReason};
/// Error returned by the library API.
#[derive(Debug, Error)]
pub enum Error {
/// Environment did not contain enough information to resolve Codex home.
#[error("failed to determine Codex home: {source}")]
Env {
/// Source environment error.
source: std::env::VarError,
},
/// Current working directory could not be read while absolutizing a path.
#[error("failed to determine current directory: {source}")]
CurrentDir {
/// Source filesystem error.
source: std::io::Error,
},
/// Filesystem operation failed.
#[error("failed to {action} at {}: {source}", path.display())]
Io {
/// Action being attempted.
action: &'static str,
/// Path involved in the failure.
path: PathBuf,
/// Source filesystem error.
source: std::io::Error,
},
/// Identity name is invalid.
#[error("invalid identity name: {name}")]
InvalidIdentityName {
/// Invalid name.
name: String,
},
/// Identity does not exist.
#[error("identity not found: {name}")]
IdentityNotFound {
/// Missing identity name.
name: IdentityName,
},
/// Identity already exists.
#[error("identity already exists: {name}")]
IdentityAlreadyExists {
/// Existing identity name.
name: IdentityName,
},
/// Identity entry exists but is unusable.
#[error("identity is broken: {name}")]
IdentityBroken {
/// Broken identity name.
name: IdentityName,
},
/// Native auth file exists and would be discarded.
#[error("native auth file exists; capture it first or pass --force to discard it")]
NativeAuthExists,
/// No native auth file exists to capture.
#[error("no native auth file to capture")]
NoNativeAuthFile,
/// Codex home does not exist.
#[error("codex home missing: {}", path.display())]
CodexHomeMissing {
/// Missing Codex home path.
path: PathBuf,
},
/// Current auth state is unknown.
#[error("unknown auth state: {reason}")]
UnknownAuthState {
/// Reason the auth state is unknown.
reason: UnknownAuthReason,
},
}