[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

@@ -7,7 +7,7 @@
#include <hal/FRCUsageReporting.h>
#include <hal/Threads.h>
#include "frc/ErrorBase.h"
#include "frc/Errors.h"
namespace frc {
@@ -16,7 +16,7 @@ int GetThreadPriority(std::thread& thread, bool* isRealTime) {
HAL_Bool rt = false;
auto native = thread.native_handle();
auto ret = HAL_GetThreadPriority(&native, &rt, &status);
wpi_setGlobalHALError(status);
FRC_CheckErrorStatus(status, "GetThreadPriority");
*isRealTime = rt;
return ret;
}
@@ -25,7 +25,7 @@ int GetCurrentThreadPriority(bool* isRealTime) {
int32_t status = 0;
HAL_Bool rt = false;
auto ret = HAL_GetCurrentThreadPriority(&rt, &status);
wpi_setGlobalHALError(status);
FRC_CheckErrorStatus(status, "GetCurrentThreadPriority");
*isRealTime = rt;
return ret;
}
@@ -34,14 +34,14 @@ bool SetThreadPriority(std::thread& thread, bool realTime, int priority) {
int32_t status = 0;
auto native = thread.native_handle();
auto ret = HAL_SetThreadPriority(&native, realTime, priority, &status);
wpi_setGlobalHALError(status);
FRC_CheckErrorStatus(status, "SetThreadPriority");
return ret;
}
bool SetCurrentThreadPriority(bool realTime, int priority) {
int32_t status = 0;
auto ret = HAL_SetCurrentThreadPriority(realTime, priority, &status);
wpi_setGlobalHALError(status);
FRC_CheckErrorStatus(status, "SetCurrentThreadPriority");
return ret;
}