Added retry_num, notify_num, last_error, last_status variables to queue expressions

This commit is contained in:
mdecimus
2024-05-06 12:55:31 +02:00
parent 54dbd9ec5e
commit 5b236e00ae
17 changed files with 427 additions and 183 deletions

View File

@@ -48,6 +48,7 @@ pub enum ConfigWarning {
Missing,
AppliedDefault { default: String },
Unread { value: String },
Build { error: String },
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
@@ -218,6 +219,7 @@ impl Config {
ConfigWarning::Unread { value } => {
format!("WARNING: Unused setting {key:?} with value {value:?}")
}
ConfigWarning::Build { error } => format!("WARNING for {key:?}: {error}"),
};
if !use_stderr {
tracing::debug!("{}", message);

View File

@@ -311,6 +311,15 @@ impl Config {
);
}
pub fn new_build_warning(&mut self, key: impl AsKey, details: impl Into<String>) {
self.warnings.insert(
key.as_key(),
ConfigWarning::Build {
error: details.into(),
},
);
}
pub fn new_missing_property(&mut self, key: impl AsKey) {
self.warnings.insert(key.as_key(), ConfigWarning::Missing);
}

View File

@@ -133,7 +133,7 @@ impl PublicSuffix {
if r.status().is_success() {
r.bytes().await
} else {
config.new_build_error(
config.new_build_warning(
format!("{value}.{idx}"),
format!(
"Failed to fetch public suffixes from {value:?}: Status {status}",
@@ -150,7 +150,7 @@ impl PublicSuffix {
match result {
Ok(bytes) => bytes.to_vec(),
Err(err) => {
config.new_build_error(
config.new_build_warning(
format!("{value}.{idx}"),
format!("Failed to fetch public suffixes from {value:?}: {err}",),
);
@@ -161,7 +161,7 @@ impl PublicSuffix {
match std::fs::read(filename) {
Ok(bytes) => bytes,
Err(err) => {
config.new_build_error(
config.new_build_warning(
format!("{value}.{idx}"),
format!("Failed to read public suffixes from {value:?}: {err}",),
);
@@ -179,7 +179,7 @@ impl PublicSuffix {
{
Ok(bytes) => bytes,
Err(err) => {
config.new_build_error(
config.new_build_warning(
format!("{value}.{idx}"),
format!(
"Failed to decompress public suffixes from {value:?}: {err}",
@@ -199,7 +199,7 @@ impl PublicSuffix {
return PublicSuffix::from(list.as_str());
}
Err(err) => {
config.new_build_error(
config.new_build_warning(
format!("{value}.{idx}"),
format!(
"Failed to parse public suffixes from {value:?}: {err}",
@@ -212,7 +212,7 @@ impl PublicSuffix {
}
#[cfg(not(feature = "test_mode"))]
config.new_build_error(key, "Failed to parse public suffixes from any source.");
config.new_build_warning(key, "Failed to parse public suffixes from any source.");
PublicSuffix::default()
}