[wpilibc] Errors: Use fmtlib

This commit is contained in:
Peter Johnson
2021-05-23 19:33:33 -07:00
parent 87603e400d
commit 831c10bdfc
55 changed files with 551 additions and 533 deletions

View File

@@ -22,8 +22,7 @@ using namespace frc;
DigitalInput::DigitalInput(int channel) {
if (!SensorUtil::CheckDigitalChannel(channel)) {
throw FRC_MakeError(err::ChannelIndexOutOfRange,
"Digital Channel " + wpi::Twine{channel});
throw FRC_MakeError(err::ChannelIndexOutOfRange, "Channel {}", channel);
}
m_channel = channel;
@@ -31,7 +30,7 @@ DigitalInput::DigitalInput(int channel) {
std::string stackTrace = wpi::GetStackTrace(1);
m_handle = HAL_InitializeDIOPort(HAL_GetPort(channel), true,
stackTrace.c_str(), &status);
FRC_CheckErrorStatus(status, "Digital Channel " + wpi::Twine{channel});
FRC_CheckErrorStatus(status, "Channel {}", channel);
HAL_Report(HALUsageReporting::kResourceType_DigitalInput, channel + 1);
SendableRegistry::GetInstance().AddLW(this, "DigitalInput", channel);
@@ -44,7 +43,7 @@ DigitalInput::~DigitalInput() {
bool DigitalInput::Get() const {
int32_t status = 0;
bool value = HAL_GetDIO(m_handle, &status);
FRC_CheckErrorStatus(status, "Get");
FRC_CheckErrorStatus(status, "Channel {}", m_channel);
return value;
}