nodejs: Remove the fclose() error handling (#261)

This commit is contained in:
George Kadianakis 2023-03-29 22:51:50 +09:00 committed by GitHub
parent 9059ba5ae2
commit 656d0c74a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -147,17 +147,10 @@ Napi::Value LoadTrustedSetup(const Napi::CallbackInfo& info) {
// Load the trusted setup from that file
C_KZG_RET ret = load_trusted_setup_file(&(data->settings), file_handle);
// Close the trusted setup file
if (fclose(file_handle) != 0) {
if (ret == C_KZG_OK) {
free_trusted_setup(&(data->settings));
}
Napi::Error::New(env, "Error closing trusted setup file").ThrowAsJavaScriptException();
return env.Undefined();
}
fclose(file_handle);
// Check that it was successful
// Check that loading the trusted setup was successful
if (ret != C_KZG_OK) {
Napi::Error::New(env, "Error loading trusted setup file: " + file_path).ThrowAsJavaScriptException();
return env.Undefined();