Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Also report toml loading failures with --watch #214

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rpxy-bin/src/config/service.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::toml::ConfigToml;
use async_trait::async_trait;
use hot_reload::{Reload, ReloaderError};
use tracing::warn;

#[derive(Clone)]
pub struct ConfigTomlReloader {
Expand All @@ -17,8 +18,10 @@ impl Reload<ConfigToml> for ConfigTomlReloader {
}

async fn reload(&self) -> Result<Option<ConfigToml>, ReloaderError<ConfigToml>> {
let conf = ConfigToml::new(&self.config_path)
.map_err(|_e| ReloaderError::<ConfigToml>::Reload("Failed to reload config toml"))?;
let conf = ConfigToml::new(&self.config_path).map_err(|e| {
warn!("Invalid toml file: {e:?}");
ReloaderError::<ConfigToml>::Reload("Failed to reload config toml")
})?;
Ok(Some(conf))
}
}