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();
|
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.
|
LOGGER.error(e.getMessage()); // print the error message, omit the stack trace.
|
||||||
shutdown(); // if we failed connecting and authenticating, then quit.
|
shutdown(); // if we failed connecting and authenticating, then quit.
|
||||||
|
@ -47,7 +47,14 @@ public class ConfigurationSource
|
|||||||
if(!fsConfigFile.exists())
|
if(!fsConfigFile.exists())
|
||||||
{
|
{
|
||||||
// try to create config file
|
// 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) {
|
catch (IOException e) {
|
||||||
LOGGER.error("Error creating configuration file!", e);
|
LOGGER.error("Error creating configuration file!", e);
|
||||||
HidekoBot.shutdown();
|
HidekoBot.shutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user