Skip to content

Commit 8af2e42

Browse files
committed
Fix load() error code: InvalidArgument → InvalidState for null runner
The !runner_ case in load() returned Error::InvalidArgument, but generate()/prefill*() treat the same condition as Error::InvalidState. Align to InvalidState for consistency. Also include model_type_category_ in the log message for debugging. This commit was authored with the help of Claude.
1 parent 192d1ee commit 8af2e42

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎extension/android/jni/jni_layer_llama.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,10 @@ class ExecuTorchLlmJni : public facebook::jni::HybridClass<ExecuTorchLlmJni> {
598598
Error,
599599
"ExecuTorchLlmJni::load() called but runner_ is null. "
600600
"The model runner was not created or failed to initialize due to a "
601-
"previous configuration or initialization error.");
602-
return static_cast<jint>(Error::InvalidArgument);
601+
"previous configuration or initialization error. "
602+
"Model type category: %d.",
603+
model_type_category_);
604+
return static_cast<jint>(Error::InvalidState);
603605
}
604606
const auto load_result = static_cast<jint>(runner_->load());
605607
if (load_result != static_cast<jint>(Error::Ok)) {

0 commit comments

Comments
 (0)