Skip to content

Commit 1d00327

Browse files
committed
Fix build: remove invalid JniException constructor call
JniException takes a jthrowable, not a string. throwExecutorchException already throws via fbjni at the JNI boundary — no need to rethrow. This commit was authored with the help of Claude.
1 parent 27ec438 commit 1d00327

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

extension/android/jni/jni_layer.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,17 +288,13 @@ class ExecuTorchJni : public facebook::jni::HybridClass<ExecuTorchJni> {
288288
module_ = std::make_unique<Module>(
289289
modelPath->toStdString(), load_mode, std::move(etdump_gen));
290290
} catch (const std::exception& e) {
291-
const std::string error_message =
292-
std::string("Failed to create Module: ") + e.what();
293291
executorch::jni_helper::throwExecutorchException(
294-
static_cast<uint32_t>(Error::Internal), error_message);
295-
throw facebook::jni::JniException(error_message);
292+
static_cast<uint32_t>(Error::Internal),
293+
std::string("Failed to create Module: ") + e.what());
296294
} catch (...) {
297-
constexpr const char* error_message =
298-
"Failed to create Module: unknown native error";
299295
executorch::jni_helper::throwExecutorchException(
300-
static_cast<uint32_t>(Error::Internal), error_message);
301-
throw facebook::jni::JniException(error_message);
296+
static_cast<uint32_t>(Error::Internal),
297+
"Failed to create Module: unknown native error");
302298
}
303299

304300
#ifdef ET_USE_THREADPOOL

0 commit comments

Comments
 (0)