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:
Thad House
2016-07-13 20:29:28 -07:00
committed by Peter Johnson
parent 05c00430b3
commit d2aa168f66
51 changed files with 175 additions and 70 deletions

View File

@@ -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;
}