pingex
/
DiscordBot
Archived
1
0
Fork 0

Super Debug 9000 mode.

master
Pingex aka Raphaël 9 years ago
parent ac4ecbcaf9
commit de2d582fa0

@ -89,34 +89,54 @@ class DiscordBot
*/
public static void main(String[] args)
{
// SET UP
System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS [%2$s/%4$s] %5$s%6$s%n");
// SUPER DEBUG 9000
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
System.out.println("Uncaught thread exception - " + e.getMessage());
e.printStackTrace(System.out);
LOGGER.info("Hello World, starting up");
LOGGER.info("DiscordBot version " + (DiscordBot.class.getPackage().getImplementationVersion() != null ? DiscordBot.class.getPackage().getImplementationVersion() : "UNKNOWN"));
System.err.println("Uncaught thread exception - " + e.getMessage());
e.printStackTrace(System.err);
});
// LOAD CONFIGURATION
try
{
Configuration.loadConfiguration("config.ini"); // TODO: pass configuration file using commandline argument
} catch (IOException e)
{
LOGGER.severe("Could not load Configuration, reason: " + e.getMessage());
System.exit(10);
}
// SET UP
System.setProperty("java.util.logging.SimpleFormatter.format", "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS [%2$s/%4$s] %5$s%6$s%n");
LOGGER.info("Logging in to Discord");
try
{
loginToDiscord();
} catch (ConfigurationException e)
{
LOGGER.severe("There is a problem with the Configuration: " + e.getMessage());
System.exit(9);
} catch (DiscordException e)
LOGGER.info("Hello World, starting up");
LOGGER.info("DiscordBot version " + (DiscordBot.class.getPackage().getImplementationVersion() != null ? DiscordBot.class.getPackage().getImplementationVersion() : "UNKNOWN"));
// LOAD CONFIGURATION
try
{
Configuration.loadConfiguration("config.ini"); // TODO: pass configuration file using commandline argument
} catch (IOException e)
{
LOGGER.severe("Could not load Configuration, reason: " + e.getMessage());
System.exit(10);
}
LOGGER.info("Logging in to Discord");
try
{
loginToDiscord();
} catch (ConfigurationException e)
{
LOGGER.severe("There is a problem with the Configuration: " + e.getMessage());
System.exit(9);
} catch (DiscordException e)
{
LOGGER.severe(e.getMessage());
System.exit(2);
}
}
catch (Throwable e)
{
LOGGER.severe(e.getMessage());
System.exit(2);
System.out.println("Uncaught exception - " + e.getMessage());
e.printStackTrace(System.out);
System.err.println("Uncaught exception - " + e.getMessage());
e.printStackTrace(System.err);
}
}