Skip to content

Commit

Permalink
Merge pull request jagrosh#1304 from LachlanPond/master
Browse files Browse the repository at this point in the history
Catch JDA exception when there is no internet connection
  • Loading branch information
jagrosh committed Mar 6, 2023
2 parents 1e12e4e + 788cd40 commit 2c76164
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/jagrosh/jmusicbot/JMusicBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.cache.CacheFlag;
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -200,5 +201,11 @@ else if(config.getGame().getName().equalsIgnoreCase("none"))
+ "invalid: " + ex + "\nConfig Location: " + config.getConfigLocation());
System.exit(1);
}
catch(ErrorResponseException ex)
{
prompt.alert(Prompt.Level.ERROR, "JMusicBot", ex + "\nInvalid reponse returned when "
+ "attempting to connect, please make sure you're connected to the internet");
System.exit(1);
}
}
}

0 comments on commit 2c76164

Please sign in to comment.