mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Fixed TimedRobot.java hanging if an exception was thrown (#926)
This commit is contained in:
committed by
Peter Johnson
parent
f720cbb121
commit
67f9c9a5b3
@@ -99,6 +99,18 @@ public class Notifier {
|
||||
}
|
||||
});
|
||||
m_thread.setDaemon(true);
|
||||
m_thread.setUncaughtExceptionHandler((thread, error) -> {
|
||||
Throwable cause = error.getCause();
|
||||
if (cause != null) {
|
||||
error = cause;
|
||||
}
|
||||
DriverStation.reportError("Unhandled exception: " + error.toString(), error.getStackTrace());
|
||||
DriverStation.reportWarning("Robots should not quit, but yours did!", false);
|
||||
DriverStation.reportError(
|
||||
"The loopFunc() method (or methods called by it) should have handled "
|
||||
+ "the exception above.", false);
|
||||
System.exit(1);
|
||||
});
|
||||
m_thread.start();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user