Improve exception handling
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-15 05:00:44 +01:00
parent d2abeb35fc
commit ee4c5155fa
3 changed files with 15 additions and 3 deletions

View File

@@ -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();