feat: better handle errors during setup

This commit is contained in:
seth 2023-12-13 11:47:08 -05:00
parent 9ae8b98e1a
commit 3e3be2aed5
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
3 changed files with 32 additions and 9 deletions

View file

@ -8,7 +8,14 @@ use poise::FrameworkError;
pub async fn handle(error: FrameworkError<'_, Data, Report>) {
match error {
FrameworkError::Setup { error, .. } => error!("Error setting up client!\n{error:#?}"),
FrameworkError::Setup {
error, framework, ..
} => {
error!("Error setting up client! Bailing out");
framework.shard_manager().lock().await.shutdown_all().await;
panic!("{error}")
}
FrameworkError::Command { error, ctx } => {
error!("Error in command {}:\n{error:?}", ctx.command().name);