llmodel_c: improve quality of error messages (#1625)

This commit is contained in:
Jared Van Bortel
2023-11-07 11:20:14 -05:00
committed by GitHub
parent 8fabf0be4a
commit d4ce9f4a7c
11 changed files with 61 additions and 70 deletions

View File

@@ -134,13 +134,10 @@ Napi::Value NodeModelWrapper::GetRequiredMemory(const Napi::CallbackInfo& info)
device = config_object.Get("device").As<Napi::String>();
}
llmodel_set_implementation_search_path(library_path.c_str());
llmodel_error e = {
.message="looks good to me",
.code=0,
};
const char* e;
inference_ = llmodel_model_create2(full_weight_path.c_str(), "auto", &e);
if(e.code != 0) {
Napi::Error::New(env, e.message).ThrowAsJavaScriptException();
if(!inference_) {
Napi::Error::New(env, e).ThrowAsJavaScriptException();
return;
}
if(GetInference() == nullptr) {