throw error instead exit (#1323)

This commit is contained in:
RGdevz
2024-09-06 04:59:21 +03:00
committed by GitHub
parent e66d4c414a
commit 1f29e4a1a9

View File

@@ -18,7 +18,9 @@ static jobjectArray ReadWaveImpl(JNIEnv *env, std::istream &is,
if (!is_ok) {
SHERPA_ONNX_LOGE("Failed to read '%s'", p_filename);
exit(-1);
jclass exception_class = env->FindClass("java/lang/Exception");
env->ThrowNew(exception_class, "Failed to read wave file.");
return nullptr;
}
jfloatArray samples_arr = env->NewFloatArray(samples.size());