Improve exception handling
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d2abeb35fc
commit
ee4c5155fa
@ -77,7 +77,12 @@ public class HidekoBot
|
||||
);
|
||||
|
||||
jda = jdaBuilder.build().awaitReady();
|
||||
} catch (Exception e)
|
||||
} catch (InterruptedException e) {
|
||||
LOGGER.error(e.getMessage()); // print the error message, omit the stack trace.
|
||||
Thread.currentThread().interrupt(); // send interrupt to the thread.
|
||||
shutdown(); // if we failed connecting and authenticating, then quit.
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.error(e.getMessage()); // print the error message, omit the stack trace.
|
||||
shutdown(); // if we failed connecting and authenticating, then quit.
|
||||
|
@ -67,7 +67,7 @@ public class Trivia
|
||||
List<TriviaCategory> categories = Trivia.parseCategories(categoriesJson);
|
||||
if(categories.isEmpty())
|
||||
return new MessageResponse("Error parsing trivia categories!", null); // todo nicer with emojis
|
||||
|
||||
|
||||
categories.sort(new TriviaCategoryComparator());
|
||||
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
|
@ -47,7 +47,14 @@ public class ConfigurationSource
|
||||
if(!fsConfigFile.exists())
|
||||
{
|
||||
// try to create config file
|
||||
try { fsConfigFile.createNewFile(); }
|
||||
try {
|
||||
if(!fsConfigFile.createNewFile())
|
||||
{
|
||||
LOGGER.error("We tried creating a file that already exists!");
|
||||
HidekoBot.shutdown();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOGGER.error("Error creating configuration file!", e);
|
||||
HidekoBot.shutdown();
|
||||
|
Loading…
Reference in New Issue
Block a user