Use Twine in error checks.

This commit is contained in:
Peter Johnson
2017-12-01 21:50:24 -08:00
parent fe53dd2f28
commit 54326311ad
9 changed files with 27 additions and 60 deletions

View File

@@ -12,8 +12,6 @@
#include <HAL/DIO.h>
#include <HAL/HAL.h>
#include <HAL/Ports.h>
#include <llvm/SmallString.h>
#include <llvm/raw_ostream.h>
#include "SmartDashboard/SendableBuilder.h"
#include "WPIErrors.h"
@@ -28,12 +26,9 @@ using namespace frc;
* @param channel The DIO channel 0-9 are on-board, 10-25 are on the MXP port
*/
DigitalInput::DigitalInput(int channel) {
llvm::SmallString<32> str;
llvm::raw_svector_ostream buf(str);
if (!CheckDigitalChannel(channel)) {
buf << "Digital Channel " << channel;
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange, buf.str());
wpi_setWPIErrorWithContext(ChannelIndexOutOfRange,
"Digital Channel " + llvm::Twine(channel));
m_channel = std::numeric_limits<int>::max();
return;
}