[wpilibc] Remove ErrorBase (#3306)

Replace with new exception-based error reporting, consistent with Java.
This also builds stacktraces into the reporting/exceptions.
This commit is contained in:
Peter Johnson
2021-04-18 20:35:29 -07:00
committed by GitHub
parent 0abf6c9045
commit 8d961dfd25
113 changed files with 993 additions and 2200 deletions

View File

@@ -12,9 +12,9 @@
#include "frc/Counter.h"
#include "frc/DigitalInput.h"
#include "frc/DigitalOutput.h"
#include "frc/Errors.h"
#include "frc/Timer.h"
#include "frc/Utility.h"
#include "frc/WPIErrors.h"
#include "frc/smartdashboard/SendableBuilder.h"
#include "frc/smartdashboard/SendableRegistry.h"
@@ -40,9 +40,11 @@ Ultrasonic::Ultrasonic(DigitalOutput* pingChannel, DigitalInput* echoChannel)
: m_pingChannel(pingChannel, NullDeleter<DigitalOutput>()),
m_echoChannel(echoChannel, NullDeleter<DigitalInput>()),
m_counter(m_echoChannel) {
if (pingChannel == nullptr || echoChannel == nullptr) {
wpi_setWPIError(NullParameter);
return;
if (!pingChannel) {
throw FRC_MakeError(err::NullParameter, "pingChannel");
}
if (!echoChannel) {
throw FRC_MakeError(err::NullParameter, "echoChannel");
}
Initialize();
}