mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilibc] Errors: Use fmtlib
This commit is contained in:
@@ -30,16 +30,16 @@ uint32_t Resource::Allocate(const std::string& resourceDesc) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
throw FRC_MakeError(err::NoAvailableResources, resourceDesc);
|
||||
throw FRC_MakeError(err::NoAvailableResources, "{}", resourceDesc);
|
||||
}
|
||||
|
||||
uint32_t Resource::Allocate(uint32_t index, const std::string& resourceDesc) {
|
||||
std::scoped_lock lock(m_allocateMutex);
|
||||
if (index >= m_isAllocated.size()) {
|
||||
throw FRC_MakeError(err::ChannelIndexOutOfRange, resourceDesc);
|
||||
throw FRC_MakeError(err::ChannelIndexOutOfRange, "{}", resourceDesc);
|
||||
}
|
||||
if (m_isAllocated[index]) {
|
||||
throw FRC_MakeError(err::ResourceAlreadyAllocated, resourceDesc);
|
||||
throw FRC_MakeError(err::ResourceAlreadyAllocated, "{}", resourceDesc);
|
||||
}
|
||||
m_isAllocated[index] = true;
|
||||
return index;
|
||||
@@ -51,10 +51,10 @@ void Resource::Free(uint32_t index) {
|
||||
return;
|
||||
}
|
||||
if (index >= m_isAllocated.size()) {
|
||||
throw FRC_MakeError(err::NotAllocated, "index " + wpi::Twine{index});
|
||||
throw FRC_MakeError(err::NotAllocated, "index {}", index);
|
||||
}
|
||||
if (!m_isAllocated[index]) {
|
||||
throw FRC_MakeError(err::NotAllocated, "index " + wpi::Twine{index});
|
||||
throw FRC_MakeError(err::NotAllocated, "index {}", index);
|
||||
}
|
||||
m_isAllocated[index] = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user