[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

@@ -4,19 +4,15 @@
#include "frc2/command/CommandGroupBase.h"
#include <frc/WPIErrors.h>
using namespace frc2;
bool CommandGroupBase::RequireUngrouped(Command& command) {
if (command.IsGrouped()) {
wpi_setGlobalWPIErrorWithContext(
CommandIllegalUse,
throw FRC_MakeError(
frc::err::CommandIllegalUse,
"Commands cannot be added to more than one CommandGroup");
return false;
} else {
return true;
}
return true;
}
bool CommandGroupBase::RequireUngrouped(
@@ -26,8 +22,8 @@ bool CommandGroupBase::RequireUngrouped(
allUngrouped &= !command.get()->IsGrouped();
}
if (!allUngrouped) {
wpi_setGlobalWPIErrorWithContext(
CommandIllegalUse,
throw FRC_MakeError(
frc::err::CommandIllegalUse,
"Commands cannot be added to more than one CommandGroup");
}
return allUngrouped;
@@ -40,8 +36,8 @@ bool CommandGroupBase::RequireUngrouped(
allUngrouped &= !command->IsGrouped();
}
if (!allUngrouped) {
wpi_setGlobalWPIErrorWithContext(
CommandIllegalUse,
throw FRC_MakeError(
frc::err::CommandIllegalUse,
"Commands cannot be added to more than one CommandGroup");
}
return allUngrouped;