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
//! Error types for authentication and configuration failures.
use thiserror::Error;
/// Errors that can occur during authentication or configuration file manipulation.
#[derive(Error, Debug)]
pub enum AuthError {
/// Authentication failure when resolving credentials via ADC or gcloud CLI.
#[error("Authentication error: {0}")]
Authentication(String),
/// No eligible registry was discovered in the npm configuration.
#[error("Configuration error: No eligible registry configuration found in .npmrc")]
NoNpmRegistry,
/// Neither Application Default Credentials nor gcloud supplied credentials.
#[error("Authentication error: Failed to get credentials from ADC or gcloud")]
CredentialsUnavailable,
/// Bun environment credentials conflict with local npm credentials.
#[error(
"Configuration error: Bun environment credentials cannot be combined with local npm credentials"
)]
BunEnvLocalCredentialConflict,
/// Bun environment credentials were requested while Bun support was disabled.
#[error("Configuration error: Bun environment credentials require Bun support")]
BunEnvDisabledConflict,
/// File system or I/O failure.
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
/// Missing or invalid configuration (e.g. no Artifact Registry scoped registry found).
#[error("Configuration error: {0}")]
Config(String),
/// Invalid source or destination Yarn configuration.
#[error("YAML parse error in {input}: {source}")]
YamlInput {
/// Whether the error came from the source or credential configuration.
input: &'static str,
/// The underlying YAML parse error.
#[source]
source: yaml_edit::YamlError,
},
/// Invalid Bun configuration.
#[error("TOML parse error in bunfig.toml: {0}")]
TomlInput(#[from] toml_edit::TomlError),
/// Regular expression compilation or matching error.
#[error("Regex error: {0}")]
Regex(#[from] regex::Error),
}