codex_auth_manager/
error.rs1use std::path::PathBuf;
2
3use thiserror::Error;
4
5use super::{IdentityName, UnknownAuthReason};
6
7#[derive(Debug, Error)]
9pub enum Error {
10 #[error("failed to determine Codex home: {source}")]
12 Env {
13 source: std::env::VarError,
15 },
16 #[error("failed to determine current directory: {source}")]
18 CurrentDir {
19 source: std::io::Error,
21 },
22 #[error("failed to {action} at {}: {source}", path.display())]
24 Io {
25 action: &'static str,
27 path: PathBuf,
29 source: std::io::Error,
31 },
32 #[error("invalid identity name: {name}")]
34 InvalidIdentityName {
35 name: String,
37 },
38 #[error("identity not found: {name}")]
40 IdentityNotFound {
41 name: IdentityName,
43 },
44 #[error("identity already exists: {name}")]
46 IdentityAlreadyExists {
47 name: IdentityName,
49 },
50 #[error("identity is broken: {name}")]
52 IdentityBroken {
53 name: IdentityName,
55 },
56 #[error("native auth file exists; capture it first or pass --force to discard it")]
58 NativeAuthExists,
59 #[error("no native auth file to capture")]
61 NoNativeAuthFile,
62 #[error("codex home missing: {}", path.display())]
64 CodexHomeMissing {
65 path: PathBuf,
67 },
68 #[error("unknown auth state: {reason}")]
70 UnknownAuthState {
71 reason: UnknownAuthReason,
73 },
74}