Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 10 additions & 10 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -794,23 +794,23 @@ NODE_EXTERN v8::MaybeLocal<v8::Value> PrepareStackTraceCallback(
// is included in the report.
// Returns the filename of the written report.
NODE_EXTERN std::string TriggerNodeReport(v8::Isolate* isolate,
const char* message,
const char* trigger,
const std::string& filename,
std::string_view message,
std::string_view trigger,
std::string_view filename,
v8::Local<v8::Value> error);
NODE_EXTERN std::string TriggerNodeReport(Environment* env,
const char* message,
const char* trigger,
const std::string& filename,
std::string_view message,
std::string_view trigger,
std::string_view filename,
v8::Local<v8::Value> error);
NODE_EXTERN void GetNodeReport(v8::Isolate* isolate,
const char* message,
const char* trigger,
std::string_view message,
std::string_view trigger,
v8::Local<v8::Value> error,
std::ostream& out);
NODE_EXTERN void GetNodeReport(Environment* env,
const char* message,
const char* trigger,
std::string_view message,
std::string_view trigger,
v8::Local<v8::Value> error,
std::ostream& out);

Expand Down
2 changes: 1 addition & 1 deletion src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static void ReportFatalException(Environment* env,
}

if (env->isolate_data()->options()->report_uncaught_exception) {
TriggerNodeReport(env, report_message.c_str(), "Exception", "", error);
TriggerNodeReport(env, report_message, "Exception", "", error);
}

if (env->options()->trace_uncaught) {
Expand Down
52 changes: 26 additions & 26 deletions src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ namespace report {
// Internal/static function declarations
static void WriteNodeReport(Isolate* isolate,
Environment* env,
const char* message,
const char* trigger,
const std::string& filename,
std::string_view message,
std::string_view trigger,
std::string_view filename,
std::ostream& out,
Local<Value> error,
bool compact,
Expand All @@ -69,11 +69,11 @@ static void PrintVersionInformation(JSONWriter* writer,
static void PrintJavaScriptErrorStack(JSONWriter* writer,
Isolate* isolate,
Local<Value> error,
const char* trigger);
std::string_view trigger);
static void PrintEmptyJavaScriptStack(JSONWriter* writer);
static void PrintJavaScriptStack(JSONWriter* writer,
Isolate* isolate,
const char* trigger);
std::string_view trigger);
static void PrintJavaScriptErrorProperties(JSONWriter* writer,
Isolate* isolate,
Local<Value> error);
Expand All @@ -92,9 +92,9 @@ static void PrintNetworkInterfaceInfo(JSONWriter* writer);
// sections of the report to the supplied stream
static void WriteNodeReport(Isolate* isolate,
Environment* env,
const char* message,
const char* trigger,
const std::string& filename,
std::string_view message,
std::string_view trigger,
std::string_view filename,
std::ostream& out,
Local<Value> error,
bool compact,
Expand Down Expand Up @@ -237,7 +237,7 @@ static void WriteNodeReport(Isolate* isolate,
std::ostringstream os;
std::string name =
"Worker thread subreport [" + std::string(w->name()) + "]";
GetNodeReport(env, name.c_str(), trigger, Local<Value>(), os);
GetNodeReport(env, name, trigger, Local<Value>(), os);

Mutex::ScopedLock lock(workers_mutex);
worker_infos.emplace_back(os.str());
Expand Down Expand Up @@ -472,7 +472,7 @@ static void PrintEmptyJavaScriptStack(JSONWriter* writer) {
// Do our best to report the JavaScript stack without calling into JavaScript.
static void PrintJavaScriptStack(JSONWriter* writer,
Isolate* isolate,
const char* trigger) {
std::string_view trigger) {
HandleScope scope(isolate);
Local<v8::StackTrace> stack;
if (!GetCurrentStackTrace(isolate, MAX_FRAME_COUNT).ToLocal(&stack)) {
Expand Down Expand Up @@ -513,7 +513,7 @@ static void PrintJavaScriptStack(JSONWriter* writer,
static void PrintJavaScriptErrorStack(JSONWriter* writer,
Isolate* isolate,
Local<Value> error,
const char* trigger) {
std::string_view trigger) {
if (error.IsEmpty()) {
return PrintJavaScriptStack(writer, isolate, trigger);
}
Expand Down Expand Up @@ -828,23 +828,23 @@ static void PrintRelease(JSONWriter* writer) {

std::string TriggerNodeReport(Isolate* isolate,
Environment* env,
const char* message,
const char* trigger,
const std::string& name,
std::string_view message,
std::string_view trigger,
std::string_view name,
Local<Value> error) {
std::string filename;

// Determine the required report filename. In order of priority:
// 1) supplied on API 2) configured on startup 3) default generated
if (!name.empty()) {
filename = name;
// we may not always be in a great state when generating a node report
// allow for the case where we don't have an env
if (env != nullptr) {
THROW_IF_INSUFFICIENT_PERMISSIONS(
env, permission::PermissionScope::kFileSystemWrite, name, name);
env, permission::PermissionScope::kFileSystemWrite, name, filename);
// Filename was specified as API parameter.
}
filename = name;
} else {
std::string report_filename;
{
Expand Down Expand Up @@ -941,9 +941,9 @@ std::string TriggerNodeReport(Isolate* isolate,

// External function to trigger a report, writing to file.
std::string TriggerNodeReport(Isolate* isolate,
const char* message,
const char* trigger,
const std::string& name,
std::string_view message,
std::string_view trigger,
std::string_view name,
Local<Value> error) {
Environment* env = nullptr;
if (isolate != nullptr) {
Expand All @@ -954,9 +954,9 @@ std::string TriggerNodeReport(Isolate* isolate,

// External function to trigger a report, writing to file.
std::string TriggerNodeReport(Environment* env,
const char* message,
const char* trigger,
const std::string& name,
std::string_view message,
std::string_view trigger,
std::string_view name,
Local<Value> error) {
return TriggerNodeReport(env != nullptr ? env->isolate() : nullptr,
env,
Expand All @@ -968,8 +968,8 @@ std::string TriggerNodeReport(Environment* env,

// External function to trigger a report, writing to a supplied stream.
void GetNodeReport(Isolate* isolate,
const char* message,
const char* trigger,
std::string_view message,
std::string_view trigger,
Local<Value> error,
std::ostream& out) {
Environment* env = nullptr;
Expand Down Expand Up @@ -997,8 +997,8 @@ void GetNodeReport(Isolate* isolate,

// External function to trigger a report, writing to a supplied stream.
void GetNodeReport(Environment* env,
const char* message,
const char* trigger,
std::string_view message,
std::string_view trigger,
Local<Value> error,
std::ostream& out) {
Isolate* isolate = nullptr;
Expand Down
Loading