chore: better logging if Node initialization fails (#45286)
feat: better logging if Node initialization fails
This commit is contained in:
parent
863faea542
commit
db7ef90159
4 changed files with 74 additions and 21 deletions
|
@ -5,6 +5,7 @@
|
|||
#ifndef ELECTRON_SHELL_COMMON_NODE_UTIL_H_
|
||||
#define ELECTRON_SHELL_COMMON_NODE_UTIL_H_
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
|
@ -13,7 +14,13 @@
|
|||
|
||||
namespace node {
|
||||
class Environment;
|
||||
class IsolateData;
|
||||
struct ThreadId;
|
||||
|
||||
namespace EnvironmentFlags {
|
||||
enum Flags : uint64_t;
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
namespace electron::util {
|
||||
|
||||
|
@ -37,6 +44,15 @@ v8::MaybeLocal<v8::Value> CompileAndCall(
|
|||
std::vector<v8::Local<v8::String>>* parameters,
|
||||
std::vector<v8::Local<v8::Value>>* arguments);
|
||||
|
||||
// Wrapper for node::CreateEnvironment that logs failure
|
||||
node::Environment* CreateEnvironment(v8::Isolate* isolate,
|
||||
node::IsolateData* isolate_data,
|
||||
v8::Local<v8::Context> context,
|
||||
const std::vector<std::string>& args,
|
||||
const std::vector<std::string>& exec_args,
|
||||
node::EnvironmentFlags::Flags env_flags,
|
||||
std::string_view process_type = "");
|
||||
|
||||
// Convenience function to view a Node buffer's data as a base::span().
|
||||
// Analogous to base::as_byte_span()
|
||||
[[nodiscard]] base::span<uint8_t> as_byte_span(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue