From ac3aa771586ee22bef976a79f2960735ba5a74dd Mon Sep 17 00:00:00 2001 From: Yizhi Liu Date: Thu, 4 Apr 2019 19:49:08 -0700 Subject: [PATCH] [tvm4j] provide error msg for failure function call (#2967) --- jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc b/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc index fada50ca76e2..d22e0459cdbc 100644 --- a/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc +++ b/jvm/native/src/main/native/ml_dmlc_tvm_native_c_api.cc @@ -178,6 +178,10 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_tvm_LibInfo_tvmFuncCall( int ret = TVMFuncCall(reinterpret_cast(jhandle), &argValues[0], &argTypes[0], numArgs, &retVal, &retTypeCode); + if (ret != 0) { + return ret; + } + for (auto iter = pushedStrs.cbegin(); iter != pushedStrs.cend(); iter++) { env->ReleaseStringUTFChars(iter->first, iter->second); env->DeleteGlobalRef(iter->first);