Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
refactor: force exit instead of panicking
Browse files Browse the repository at this point in the history
  • Loading branch information
nashiradeer committed Apr 16, 2024
1 parent 3ac86d2 commit 8784407
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl EventHandler for HydrogenHandler {

if !register_commands(None, &ctx.http, &self.context.commands_id).await {
error!("(ready): cannot register commands");
panic!("cannot register commands");
exit(1);
}
}

Expand Down Expand Up @@ -333,15 +333,15 @@ async fn main() {
Ok(v) => v,
Err(e) => {
error!("cannot initialize time parsers: {}", e);
panic!("cannot initialize time parsers");
exit(1)
}
});

let roll_parser = Arc::new(match RollParser::new() {
Ok(v) => v,
Err(e) => {
error!("cannot initialize roll parser: {}", e);
panic!("cannot initialize roll parser");
exit(1);
}
});

Expand Down
4 changes: 3 additions & 1 deletion src/manager.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{
collections::HashMap,
fmt::Display,
process::exit,
result,
sync::{
atomic::{AtomicUsize, Ordering},
Expand Down Expand Up @@ -761,7 +762,8 @@ impl LavalinkHandler for HydrogenManager {
}

if lavalink_nodes.len() == 0 {
panic!("(disconnect): no lavalink nodes connected.");
error!("(disconnect): no lavalink nodes connected.");
exit(1);
}

let mut players = self.player.write().await;
Expand Down

0 comments on commit 8784407

Please sign in to comment.