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)
{
case ZT_RESULT_OK:
case ZT_RESULT_OK_IGNORED:
LOGV("ZT_RESULT_OK");
fieldName = "RESULT_OK";
break;
@ -56,12 +57,20 @@ jobject createResultObject(JNIEnv *env, ZT_ResultCode code)
fieldName = "RESULT_FATAL_ERROR_DATA_STORE_FAILED";
break;
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";
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:
default:
LOGV("RESULT_FATAL_ERROR_DATA_STORE_FAILED");
LOGV("ZT_RESULT_FATAL_ERROR_INTERNAL");
fieldName = "RESULT_FATAL_ERROR_INTERNAL";
break;
}

View File

@ -45,30 +45,35 @@ public enum ResultCode {
/**
* 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
*/
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)
*/
RESULT_FATAL_ERROR_INTERNAL(3),
RESULT_FATAL_ERROR_INTERNAL(102),
// non-fatal errors
/**
* 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;
ResultCode(int id) { this.id = id; }
public int getValue() { return id; }
public boolean isFatal(int id) {
return (id > 0 && id < 1000);
return (id > 100 && id < 1000);
}
}