[wpilibj] Crash robot program if an exception occurs during opmode construction (#8982)

There's essentially nothing the user can do here, other then switch
opmodes. It will make it clearer that something is very wrong.
This commit is contained in:
Thad House
2026-06-19 14:51:46 -07:00
committed by GitHub
parent ad797456f5
commit 0b950ea6d9

View File

@@ -118,9 +118,8 @@ public abstract class OpModeRobot extends RobotBase {
try {
return constructor.get().newInstance(this);
} catch (ReflectiveOperationException e) {
DriverStationErrors.reportError(
"Could not instantiate OpMode " + cls.getSimpleName(), e.getStackTrace());
return null;
throw new RuntimeException(
"Could not instantiate OpMode " + cls.getSimpleName(), e.getCause());
}
}