Skip to content

Commit a2ae3e5

Browse files
committed
Improve signer reload logging
1 parent 797bc87 commit a2ae3e5

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

crates/signer/src/service.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,40 @@ async fn handle_reload(
230230

231231
debug!(event = "reload", ?req_id, "New request");
232232

233-
let config = StartSignerConfig::load_from_env()
234-
.map_err(|err| SignerModuleError::Internal(err.to_string()))?;
233+
let config = match StartSignerConfig::load_from_env() {
234+
Ok(config) => config,
235+
Err(err) => {
236+
error!(event = "reload", ?req_id, error = ?err, "Failed to reload config");
237+
return Err(SignerModuleError::Internal("failed to reload config".to_string()));
238+
}
239+
};
235240

236241
let proxy_store = if let Some(store) = config.store {
237-
Some(store.init_from_env().map_err(|err| SignerModuleError::Internal(err.to_string()))?)
242+
let store = store.init_from_env();
243+
match store {
244+
Ok(store) => Some(store),
245+
Err(err) => {
246+
error!(event = "reload", ?req_id, error = ?err, "Failed to reload proxy store");
247+
return Err(SignerModuleError::Internal("failed to reload config".to_string()));
248+
}
249+
}
238250
} else {
239251
warn!("Proxy store not configured. Proxies keys and delegations will not be persisted");
240252
None
241253
};
242254

243-
let mut new_manager = SigningManager::new(config.chain, proxy_store)
244-
.map_err(|err| SignerModuleError::Internal(err.to_string()))?;
255+
let mut new_manager = match SigningManager::new(config.chain, proxy_store) {
256+
Ok(manager) => manager,
257+
Err(err) => {
258+
error!(event = "reload", ?req_id, error = ?err, "Failed to reload manager");
259+
return Err(SignerModuleError::Internal("failed to reload config".to_string()));
260+
}
261+
};
245262

246-
for signer in
247-
config.loader.load_keys().map_err(|err| SignerModuleError::Internal(err.to_string()))?
263+
for signer in config
264+
.loader
265+
.load_keys()
266+
.map_err(|_| SignerModuleError::Internal("failed to reload config".to_string()))?
248267
{
249268
new_manager.add_consensus_signer(signer);
250269
}

0 commit comments

Comments
 (0)