Skip to content

Commit

Permalink
throw error instead exit (k2-fsa#1323)
Browse files Browse the repository at this point in the history
  • Loading branch information
RGdevz authored Sep 6, 2024
1 parent f33f3ff commit 4323bd2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sherpa-onnx/jni/wave-reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 4323bd2

Please sign in to comment.