Make sure the whole JVM exits if an exception is thrown. This prevents the DS thread, NT thread or any additional user thread from keeping the program alive when the main thread exits (fixes artf3743)

Change-Id: Ide89a3abe57171553af0a8c68077391b9a91fd29
This commit is contained in:
Kevin O'Connor
2014-11-04 12:42:03 -05:00
committed by James Kuszmaul
parent de5e5ab405
commit 18de3aebdd

View File

@@ -182,9 +182,11 @@ public abstract class RobotBase {
RobotBase robot;
try {
robot = (RobotBase) Class.forName(robotName).newInstance();
} catch (InstantiationException|IllegalAccessException|ClassNotFoundException e) {
} catch (Throwable t) {
DriverStation.reportError("ERROR Unhandled exception instantiating robot " + robotName + " " + t.toString() + " at " + Arrays.toString(t.getStackTrace()), false);
System.err.println("WARNING: Robots don't quit!");
System.err.println("ERROR: Could not instantiate robot "+robotName+"!");
System.exit(1);
return;
}
@@ -202,5 +204,6 @@ public abstract class RobotBase {
System.err.println("---> Unexpected return from startCompetition() method.");
}
}
System.exit(1);
}
}