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

38 lines
1.3 KiB
Rust

// SPDX-License-Identifier: CPAL-1.0
// Copyright (c) 2026 Marek Novák. Part of Ianitor, under the Common Public Attribution
// License 1.0: see LICENSE (its Exhibit A is this file's notice).
//! 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),
}