Files
ianitor/crates/edge/src/error.rs
T

38 lines
1.3 KiB
Rust

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//! Startup errors. None of them ever carries a secret value.
use std::path::PathBuf;
#[derive(Debug, thiserror::Error)]
pub enum EdgeError {
#[error("cannot read {path}: {source}")]
Read {
path: PathBuf,
source: std::io::Error,
},
#[error("cannot write {path}: {source}")]
Write {
path: PathBuf,
source: std::io::Error,
},
#[error("{path} is not a valid edge config: {message}")]
Config { path: PathBuf, message: String },
#[error("edge config version {found} is not supported (this build reads version {expected})")]
Version { found: u32, expected: u32 },
#[error("secret `{name}`: {reason}")]
Secret { name: String, reason: &'static str },
#[error("certificate for {host}: {reason}")]
Cert { host: String, reason: String },
#[error("upstream {address}: {reason}")]
Upstream { address: String, reason: String },
#[error("header `{name}`: {reason}")]
Header { name: String, reason: &'static str },
#[error("listener {address}: {reason}")]
Listen { address: String, reason: String },
#[error("command line: {0}")]
Usage(String),
}