chore: remove node patches by using the preload feature (#41080)

This commit is contained in:
Cheng Zhao 2024-01-25 00:54:32 +09:00 committed by GitHub
parent 031d636823
commit d13a93fb61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 403 additions and 135 deletions

View file

@ -5,6 +5,7 @@
#include "shell/common/node_util.h"
#include "base/logging.h"
#include "gin/converter.h"
#include "shell/common/node_includes.h"
namespace electron::util {
@ -31,7 +32,14 @@ v8::MaybeLocal<v8::Value> CompileAndCall(
// This will only be caught when something has gone terrible wrong as all
// electron scripts are wrapped in a try {} catch {} by webpack
if (try_catch.HasCaught()) {
LOG(ERROR) << "Failed to CompileAndCall electron script: " << id;
std::string msg = "no error message";
if (!try_catch.Message().IsEmpty()) {
gin::ConvertFromV8(isolate, try_catch.Message()->Get(), &msg);
} else if (try_catch.HasTerminated()) {
msg = "script execution has been terminated";
}
LOG(ERROR) << "Failed to CompileAndCall electron script (" << id
<< "): " << msg;
}
return ret;
}