mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Implements Better Error Messages from the HAL (#172)
* Makes the HAL provide a better error message for certain things. * Makes Java error messages better * Updates C++ errors. * Moves handles header folder to HAL directory
This commit is contained in:
committed by
Peter Johnson
parent
05c00430b3
commit
d2aa168f66
@@ -14,10 +14,19 @@
|
||||
|
||||
extern JavaVM *jvm;
|
||||
|
||||
void ReportError(JNIEnv *env, int32_t status, bool do_throw = true);
|
||||
void ReportError(JNIEnv *env, int32_t status, int32_t minRange, int32_t maxRange,
|
||||
int32_t requestedValue, bool do_throw = true);
|
||||
|
||||
inline bool CheckStatus(JNIEnv *env, int32_t status, bool do_throw = true) {
|
||||
if (status != 0) ReportError(env, status, do_throw);
|
||||
if (status != 0) ReportError(env, status, 0, 0, 0, do_throw);
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
inline bool CheckStatusRange(JNIEnv *env, int32_t status, int32_t minRange,
|
||||
int32_t maxRange, int32_t requestedValue,
|
||||
bool do_throw = true) {
|
||||
if (status != 0) ReportError(env, status, minRange, maxRange, requestedValue,
|
||||
do_throw);
|
||||
return status == 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user