[wpilibc] Prevent StopMotor from terminating robot during MotorSafety check (#4038)

- Nothing else in that function can throw, so protecting StopMotor should be sufficient
- Fixes #4036
This commit is contained in:
Dustin Spicuzza
2022-02-19 23:42:10 -05:00
committed by GitHub
parent 27847d7eb2
commit 4bd1f526ab
2 changed files with 15 additions and 1 deletions

View File

@@ -98,7 +98,15 @@ void MotorSafety::Check() {
if (stopTime < Timer::GetFPGATimestamp()) {
FRC_ReportError(err::Timeout, "{}... Output not updated often enough",
GetDescription());
StopMotor();
try {
StopMotor();
} catch (frc::RuntimeError& e) {
e.Report();
} catch (std::exception& e) {
FRC_ReportError(err::Error, "{} StopMotor threw unexpected exception: {}",
GetDescription(), e.what());
}
}
}