Add new ZT_ result codes that were added

This commit is contained in:
Grant Limberg 2020-05-18 10:31:17 -07:00
parent f8ba1962e6
commit 844725237d
No known key found for this signature in database
GPG key ID: 2BA62CCABBB4095A
2 changed files with 21 additions and 7 deletions

View file

@ -44,6 +44,7 @@ jobject createResultObject(JNIEnv *env, ZT_ResultCode code)
switch(code) switch(code)
{ {
case ZT_RESULT_OK: case ZT_RESULT_OK:
case ZT_RESULT_OK_IGNORED:
LOGV("ZT_RESULT_OK"); LOGV("ZT_RESULT_OK");
fieldName = "RESULT_OK"; fieldName = "RESULT_OK";
break; break;
@ -56,12 +57,20 @@ jobject createResultObject(JNIEnv *env, ZT_ResultCode code)
fieldName = "RESULT_FATAL_ERROR_DATA_STORE_FAILED"; fieldName = "RESULT_FATAL_ERROR_DATA_STORE_FAILED";
break; break;
case ZT_RESULT_ERROR_NETWORK_NOT_FOUND: case ZT_RESULT_ERROR_NETWORK_NOT_FOUND:
LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED"); LOGV("ZT_RESULT_ERROR_NETWORK_NOT_FOUND");
fieldName = "RESULT_ERROR_NETWORK_NOT_FOUND"; fieldName = "RESULT_ERROR_NETWORK_NOT_FOUND";
break; break;
case ZT_RESULT_ERROR_UNSUPPORTED_OPERATION:
LOGV("ZT_RESULT_ERROR_UNSUPPORTED_OPERATION");
fieldName = "RESULT_ERROR_UNSUPPORTED_OPERATION";
break;
case ZT_RESULT_ERROR_BAD_PARAMETER:
LOGV("ZT_RESULT_ERROR_BAD_PARAMETER");
fieldName = "ZT_RESULT_ERROR_BAD_PARAMETER";
break;
case ZT_RESULT_FATAL_ERROR_INTERNAL: case ZT_RESULT_FATAL_ERROR_INTERNAL:
default: default:
LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED"); LOGV("ZT_RESULT_FATAL_ERROR_INTERNAL");
fieldName = "RESULT_FATAL_ERROR_INTERNAL"; fieldName = "RESULT_FATAL_ERROR_INTERNAL";
break; break;
} }

View file

@ -45,30 +45,35 @@ public enum ResultCode {
/** /**
* Ran out of memory * Ran out of memory
*/ */
RESULT_FATAL_ERROR_OUT_OF_MEMORY(1), RESULT_FATAL_ERROR_OUT_OF_MEMORY(100),
/** /**
* Data store is not writable or has failed * Data store is not writable or has failed
*/ */
RESULT_FATAL_ERROR_DATA_STORE_FAILED(2), RESULT_FATAL_ERROR_DATA_STORE_FAILED(101),
/** /**
* Internal error (e.g. unexpected exception indicating bug or build problem) * Internal error (e.g. unexpected exception indicating bug or build problem)
*/ */
RESULT_FATAL_ERROR_INTERNAL(3), RESULT_FATAL_ERROR_INTERNAL(102),
// non-fatal errors // non-fatal errors
/** /**
* Network ID not valid * Network ID not valid
*/ */
RESULT_ERROR_NETWORK_NOT_FOUND(1000); RESULT_ERROR_NETWORK_NOT_FOUND(1000),
RESULT_ERROR_UNSUPPORTED_OPERATION(1001),
RESULT_ERROR_BAD_PARAMETER(1002);
private final int id; private final int id;
ResultCode(int id) { this.id = id; } ResultCode(int id) { this.id = id; }
public int getValue() { return id; } public int getValue() { return id; }
public boolean isFatal(int id) { public boolean isFatal(int id) {
return (id > 0 && id < 1000); return (id > 100 && id < 1000);
} }
} }