Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! src: throw error in LoadBuiltinModuleSource when reading fails
Co-authored-by: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
joyeecheung and RaisinTen authored Jun 2, 2021
commit d88d33d1c57bbc1a392937ffd194fcf128d28005
13 changes: 5 additions & 8 deletions src/node_native_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,11 @@ MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate,
std::string contents;
int r = ReadFileSync(&contents, filename.c_str());
if (r != 0) {
char buf[256];
snprintf(buf,
sizeof(buf),
"Cannot read local builtin. %s: %s \"%s\"",
uv_err_name(r),
uv_strerror(r),
filename.c_str());
Local<String> message = OneByteString(isolate, buf);
const std::string buf = SPrintF("Cannot read local builtin. %s: %s \"%s\"",
uv_err_name(r),
uv_strerror(r),
filename);
Local<String> message = OneByteString(isolate, buf.c_str());
isolate->ThrowException(v8::Exception::Error(message));
return MaybeLocal<String>();
}
Expand Down