[core] Compilers: Pingora runtime config and Caddy JSON, golden files
This commit is contained in:
@@ -11,7 +11,11 @@ use std::fmt;
|
||||
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
||||
pub enum ValidationError {
|
||||
#[error("{file}: the file is not valid TOML{}: {message}", line_suffix(*line))]
|
||||
Syntax { file: String, line: Option<usize>, message: String },
|
||||
Syntax {
|
||||
file: String,
|
||||
line: Option<usize>,
|
||||
message: String,
|
||||
},
|
||||
#[error("{file}: unknown field `{field}`")]
|
||||
UnknownField { file: String, field: String },
|
||||
#[error("{file}: required field `{field}` is missing")]
|
||||
@@ -21,31 +25,55 @@ pub enum ValidationError {
|
||||
#[error("{file} appears twice in the routes")]
|
||||
DuplicateFile { file: String },
|
||||
#[error("{file}: `{hostname}` is not a valid hostname: {reason}")]
|
||||
InvalidHostname { file: String, hostname: String, reason: &'static str },
|
||||
InvalidHostname {
|
||||
file: String,
|
||||
hostname: String,
|
||||
reason: &'static str,
|
||||
},
|
||||
#[error("hostname `{hostname}` is defined twice: in {first} and in {second}")]
|
||||
DuplicateHostname { hostname: String, first: String, second: String },
|
||||
DuplicateHostname {
|
||||
hostname: String,
|
||||
first: String,
|
||||
second: String,
|
||||
},
|
||||
#[error("{file}: at least one upstream is needed")]
|
||||
NoUpstreams { file: String },
|
||||
#[error("{file}: upstream `{url}` is not usable: {reason}")]
|
||||
BadUpstreamUrl { file: String, url: String, reason: &'static str },
|
||||
BadUpstreamUrl {
|
||||
file: String,
|
||||
url: String,
|
||||
reason: &'static str,
|
||||
},
|
||||
#[error("{file}: upstream `{url}` is listed twice")]
|
||||
DuplicateUpstream { file: String, url: String },
|
||||
#[error("{file}: secret `{secret}` is used but not declared in the site file")]
|
||||
UndefinedSecret { file: String, secret: String },
|
||||
#[error("{file}: response header `{header}` may not use a secret; secrets only go to upstreams")]
|
||||
#[error(
|
||||
"{file}: response header `{header}` may not use a secret; secrets only go to upstreams"
|
||||
)]
|
||||
SecretInResponseHeader { file: String, header: String },
|
||||
#[error("{file}: `{name}` is not a valid secret name (use a-z, 0-9, '_' and '-', at most 64 characters)")]
|
||||
#[error(
|
||||
"{file}: `{name}` is not a valid secret name (use a-z, 0-9, '_' and '-', at most 64 characters)"
|
||||
)]
|
||||
InvalidSecretName { file: String, name: String },
|
||||
#[error("{file}: `{name}` is not a valid header name")]
|
||||
InvalidHeaderName { file: String, name: String },
|
||||
#[error("{file}: value for header `{header}` is not allowed: {reason}")]
|
||||
InvalidHeaderValue { file: String, header: String, reason: &'static str },
|
||||
InvalidHeaderValue {
|
||||
file: String,
|
||||
header: String,
|
||||
reason: &'static str,
|
||||
},
|
||||
#[error("{file}: header `{header}` is managed by the proxy and cannot be changed by a rule")]
|
||||
ProtectedHeader { file: String, header: String },
|
||||
#[error("{file}: header `{header}` has more than one rule in the same list")]
|
||||
DuplicateHeaderRule { file: String, header: String },
|
||||
#[error("{file}: rule for header `{header}` is incomplete: {reason}")]
|
||||
BadHeaderRule { file: String, header: String, reason: &'static str },
|
||||
BadHeaderRule {
|
||||
file: String,
|
||||
header: String,
|
||||
reason: &'static str,
|
||||
},
|
||||
#[error("{file}: health check is not usable: {reason}")]
|
||||
BadHealthCheck { file: String, reason: &'static str },
|
||||
#[error("{file}: auth = \"forward-auth\" needs a [forward_auth] section in the site file")]
|
||||
|
||||
Reference in New Issue
Block a user