added some more error messages

Dieser Commit ist enthalten in:
Sebastian Tobie 2025-05-15 21:00:22 +02:00
Ursprung 11f7df2116
Commit 01a4a64ae6
2 geänderte Dateien mit 28 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -114,9 +114,16 @@ async fn racme(flags: Arguments) -> Result<(), Error> {
ReadDirStream::new(rd)
};
let mut siteconfigs = Vec::new();
for file in files.filter(Result::is_ok).map(|file| file.unwrap().path()).collect::<Vec<PathBuf>>().await {
let mut site = SiteConfig::from_file(FILE_MODE.open(file.clone()).await.unwrap()).await;
site.name = file.file_stem().unwrap().to_str().unwrap().to_string();
for filename in files.filter(Result::is_ok).map(|file| file.unwrap().path()).collect::<Vec<PathBuf>>().await {
let file = match FILE_MODE.open(filename.clone()).await {
Ok(file) => file,
Err(error) => {
warn!("Failed to read the configfile {}: {}", filename.display(), error);
continue;
},
};
let mut site = SiteConfig::from_file(file).await;
site.name = filename.file_stem().unwrap().to_string_lossy().to_string();
siteconfigs.push(site);
}
let used = siteconfigs.iter().map(|s| s.ca.clone()).collect::<HashSet<_>>();
@ -174,7 +181,13 @@ async fn racme(flags: Arguments) -> Result<(), Error> {
fn main() {
log_init();
let runtime = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
let runtime = match tokio::runtime::Builder::new_current_thread().enable_all().build() {
Ok(runtime) => runtime,
Err(error) => {
error!("Could not initialize Tokio runtime: {error}");
exit(2)
},
};
let result = runtime.block_on(racme(Arguments::parse()));
runtime.shutdown_timeout(Duration::from_secs(1));
if let Err(error) = result {

Datei anzeigen

@ -311,7 +311,17 @@ pub async fn site(args: ProcessorArgs<'_>) {
error!("Failed to complete the order: check the logs for more information");
return;
}
let certs = order.certificate().await.unwrap().unwrap();
let certs = match order.certificate().await {
Err(error) => {
error!("Failed to retrieve the certificates: {error}");
return;
},
Ok(None) => {
error!("The list of Certificate is Empty");
return;
},
Ok(Some(certs)) => certs,
};
debug!("Received {} certificates.", certs.len());
let mut pubkey_file = match_error!(FILE_MODE_WRITE.open(pubkey_filename).await=>Err(error)-> "Failed to open the file for the publickey: {error}");
match_error!(pubkey_file.write_all(&certs[0].to_pem().unwrap()).await=>Err(error)-> "Failed to write the publickey: {error}");