Skip to main content

node_auth/
error.rs

1//! Error types for authentication and configuration failures.
2
3use thiserror::Error;
4
5/// Errors that can occur during authentication or configuration file manipulation.
6#[derive(Error, Debug)]
7pub enum AuthError {
8  /// Authentication failure when resolving credentials via ADC or gcloud CLI.
9  #[error("Authentication error:\n{0}")]
10  Authentication(String),
11
12  /// File system or I/O failure.
13  #[error("IO error: {0}")]
14  Io(#[from] std::io::Error),
15
16  /// Missing or invalid configuration (e.g. no Artifact Registry scoped registry found).
17  #[error("Configuration error: {0}")]
18  Config(String),
19
20  /// Invalid source or destination Yarn configuration.
21  #[error("YAML parse error in {input}: {source}")]
22  YamlInput {
23    /// Whether the error came from the source or credential configuration.
24    input: &'static str,
25    /// The underlying YAML parse error.
26    #[source]
27    source: yaml_edit::YamlError,
28  },
29
30  /// Invalid Bun configuration.
31  #[error("TOML parse error in bunfig.toml: {0}")]
32  TomlInput(#[from] toml_edit::TomlError),
33
34  /// Regular expression compilation or matching error.
35  #[error("Regex error: {0}")]
36  Regex(#[from] regex::Error),
37}