[hal] Use last error reporting instead of PARAMETER_OUT_OF_RANGE (#3328)

Makes the error messages much more specific to each error.
This commit is contained in:
Thad House
2021-05-01 13:22:08 -07:00
committed by GitHub
parent 23d2326d1d
commit 3c08461685
15 changed files with 89 additions and 21 deletions

View File

@@ -115,10 +115,6 @@ void AnalogGyro::InitGyro() {
std::string stackTrace = wpi::GetStackTrace(1);
m_gyroHandle =
HAL_InitializeAnalogGyro(m_analog->m_port, stackTrace.c_str(), &status);
if (status == PARAMETER_OUT_OF_RANGE) {
throw FRC_MakeError(err::ParameterOutOfRange,
"channel must be accumulator channel");
}
FRC_CheckErrorStatus(status, "InitializeAnalogGyro");
}