Skip to content

Commit

Permalink
Refactor(typescript)/error handling (nomic-ai#1283)
Browse files Browse the repository at this point in the history
* actually display error if it occurs while instantiating

* bump version
  • Loading branch information
jacoobes authored Jul 27, 2023
1 parent 9100b2e commit 0e866a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions gpt4all-bindings/typescript/index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ Napi::Function NodeModelWrapper::GetClass(Napi::Env env) {
}
}
llmodel_set_implementation_search_path(library_path.c_str());
llmodel_error* e = nullptr;
inference_ = std::make_shared<llmodel_model>(llmodel_model_create2(full_weight_path.c_str(), "auto", e));
if(e != nullptr) {
Napi::Error::New(env, e->message).ThrowAsJavaScriptException();
llmodel_error e = {
.message="looks good to me",
.code=0,
};
inference_ = std::make_shared<llmodel_model>(llmodel_model_create2(full_weight_path.c_str(), "auto", &e));
if(e.code != 0) {
Napi::Error::New(env, e.message).ThrowAsJavaScriptException();
return;
}
if(GetInference() == nullptr) {
Expand Down
2 changes: 1 addition & 1 deletion gpt4all-bindings/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gpt4all",
"version": "2.1.0-alpha",
"version": "2.1.1-alpha",
"packageManager": "[email protected]",
"main": "src/gpt4all.js",
"repository": "nomic-ai/gpt4all",
Expand Down

0 comments on commit 0e866a0

Please sign in to comment.