Skip to content

Commit ec82b0e

Browse files
committed
logging: improve error messages
1 parent cf72d6a commit ec82b0e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • packages/react-native-executorch/common/rnexecutorch/models/llm

packages/react-native-executorch/common/rnexecutorch/models/llm/LLM.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ LLM::LLM(const std::string &modelSource, const std::string &tokenizerSource,
1414
callInvoker(callInvoker) {
1515
auto loadResult = runner->load();
1616
if (loadResult != Error::Ok) {
17-
throw std::runtime_error("Failed to load LLM runner");
17+
throw std::runtime_error("Failed to load LLM runner, error code: " +
18+
std::to_string(static_cast<int>(loadResult)));
1819
}
1920
memorySizeLowerBound =
2021
std::filesystem::file_size(std::filesystem::path(modelSource)) +
@@ -35,7 +36,7 @@ void LLM::generate(std::string input, std::shared_ptr<jsi::Function> callback) {
3536

3637
auto error = runner->generate(input, nativeCallback, {}, false);
3738
if (error != executorch::runtime::Error::Ok) {
38-
throw std::runtime_error("Failed to generate text, error: " +
39+
throw std::runtime_error("Failed to generate text, error code: " +
3940
std::to_string(static_cast<int>(error)));
4041
}
4142
}

0 commit comments

Comments
 (0)