mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user