Skip to content

Commit

Permalink
fix: log tasks errrors
Browse files Browse the repository at this point in the history
  • Loading branch information
wvffle committed Nov 3, 2024
1 parent 9769ac4 commit 9608806
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,50 @@ async fn main() -> Result<()> {
tokio::select! {
_ = tokio::signal::ctrl_c() => { info!("Shutting down..."); },
result = tokio::spawn(scrapper) => {
if let Err(e) = result {
error!("Scrapper task failed: {}", e);
} else {
info!("Scrapper task finished");
match result {
Err(e) => {
error!("Scrapper task failed: {}", e);
}
Ok(()) => {
info!("Scrapper task finished");
}
}

},

result = tokio::spawn(factorio) => {
if let Err(e) = result {
error!("Factorio log reading task failed: {}", e);
} else {
info!("Factorio log reading task finished");
match result {
Err(e) => {
error!("Factorio log reading task failed: {}", e);
}
Ok(Err(e)) => {
error!("Factorio log reading task failed: {}", e);
}
Ok(Ok(())) => {
info!("Factorio log reading task finished");
}
}
},
result = tokio::spawn(telegram) => {
if let Err(e) = result {
error!("Telegram message receiving task failed: {}", e);
} else {
info!("Telegram message receiving task finished");
match result {
Err(e) => {
error!("Telegram message receiving task failed: {}", e);
}
Ok(Err(e)) => {
error!("Telegram message receiving task failed: {}", e);
}
Ok(Ok(())) => {
info!("Telegram message receiving task finished");
}
}
},
result = tokio::spawn(bridge(rx)) => {
if let Err(e) = result {
error!("Bridge task failed: {}", e);
} else {
info!("Bridge task finished");
match result {
Err(e) => {
error!("Bridge task failed: {}", e);
}
Ok(()) => {
info!("Bridge task finished");
}
}
},
}
Expand Down

0 comments on commit 9608806

Please sign in to comment.