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) public static void main(String[] args)
{ {
// SET UP // SUPER DEBUG 9000
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"); Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
System.out.println("Uncaught thread exception - " + e.getMessage());
e.printStackTrace(System.out);
LOGGER.info("Hello World, starting up"); System.err.println("Uncaught thread exception - " + e.getMessage());
LOGGER.info("DiscordBot version " + (DiscordBot.class.getPackage().getImplementationVersion() != null ? DiscordBot.class.getPackage().getImplementationVersion() : "UNKNOWN")); e.printStackTrace(System.err);
});
// LOAD CONFIGURATION
try try
{ {
Configuration.loadConfiguration("config.ini"); // TODO: pass configuration file using commandline argument // SET UP
} catch (IOException e) 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.severe("Could not load Configuration, reason: " + e.getMessage());
System.exit(10);
}
LOGGER.info("Logging in to Discord"); LOGGER.info("Hello World, starting up");
try LOGGER.info("DiscordBot version " + (DiscordBot.class.getPackage().getImplementationVersion() != null ? DiscordBot.class.getPackage().getImplementationVersion() : "UNKNOWN"));
{
loginToDiscord(); // LOAD CONFIGURATION
} catch (ConfigurationException e) try
{ {
LOGGER.severe("There is a problem with the Configuration: " + e.getMessage()); Configuration.loadConfiguration("config.ini"); // TODO: pass configuration file using commandline argument
System.exit(9); } catch (IOException e)
} catch (DiscordException 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.out.println("Uncaught exception - " + e.getMessage());
System.exit(2); e.printStackTrace(System.out);
System.err.println("Uncaught exception - " + e.getMessage());
e.printStackTrace(System.err);
} }
} }