diff --git a/doc/api/report.md b/doc/api/report.md index 90173a1cfaa154..856cd80119ab79 100644 --- a/doc/api/report.md +++ b/doc/api/report.md @@ -23,7 +23,7 @@ is provided below for reference. { "header": { "event": "exception", - "location": "OnUncaughtException", + "trigger": "Exception", "filename": "report.20181221.005011.8974.001.json", "dumpEventTime": "2018-12-21T00:50:11Z", "dumpEventTimeStamp": "1545371411331", diff --git a/src/node_errors.cc b/src/node_errors.cc index 17394c863cd079..1c15b5558457d4 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -318,7 +318,7 @@ void OnFatalError(const char* location, const char* message) { Environment* env = Environment::GetCurrent(isolate); if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) { report::TriggerNodeReport( - isolate, env, message, __func__, "", Local()); + isolate, env, message, "FatalError", "", Local()); } #endif // NODE_REPORT fflush(stderr); diff --git a/src/node_report.cc b/src/node_report.cc index 4617fb627155de..85c66a51bf70dd 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -70,7 +70,7 @@ using v8::Value; static void WriteNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, const std::string& filename, std::ostream& out, Local stackstr, @@ -79,7 +79,7 @@ static void PrintVersionInformation(JSONWriter* writer); static void PrintJavaScriptStack(JSONWriter* writer, Isolate* isolate, Local stackstr, - const char* location); + const char* trigger); static void PrintNativeStack(JSONWriter* writer); #ifndef _WIN32 static void PrintResourceUsage(JSONWriter* writer); @@ -100,7 +100,7 @@ static std::atomic_int seq = {0}; // sequence number for report filenames std::string TriggerNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, std::string name, Local stackstr) { std::ostringstream oss; @@ -178,7 +178,7 @@ std::string TriggerNodeReport(Isolate* isolate, << "Writing Node.js report to file: " << filename << std::endl; } - WriteNodeReport(isolate, env, message, location, filename, *outstream, + WriteNodeReport(isolate, env, message, trigger, filename, *outstream, stackstr, &tm_struct); // Do not close stdout/stderr, only close files we opened. @@ -194,14 +194,14 @@ std::string TriggerNodeReport(Isolate* isolate, void GetNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, Local stackstr, std::ostream& out) { // Obtain the current time and the pid (platform dependent) TIME_TYPE tm_struct; LocalTime(&tm_struct); WriteNodeReport( - isolate, env, message, location, "", out, stackstr, &tm_struct); + isolate, env, message, trigger, "", out, stackstr, &tm_struct); } // Internal function to coordinate and write the various @@ -209,7 +209,7 @@ void GetNodeReport(Isolate* isolate, static void WriteNodeReport(Isolate* isolate, Environment* env, const char* message, - const char* location, + const char* trigger, const std::string& filename, std::ostream& out, Local stackstr, @@ -228,7 +228,7 @@ static void WriteNodeReport(Isolate* isolate, writer.json_objectstart("header"); writer.json_keyvalue("event", message); - writer.json_keyvalue("location", location); + writer.json_keyvalue("trigger", trigger); if (!filename.empty()) writer.json_keyvalue("filename", filename); else @@ -280,7 +280,7 @@ static void WriteNodeReport(Isolate* isolate, writer.json_objectend(); // Report summary JavaScript stack backtrace - PrintJavaScriptStack(&writer, isolate, stackstr, location); + PrintJavaScriptStack(&writer, isolate, stackstr, trigger); // Report native stack backtrace PrintNativeStack(&writer); @@ -372,12 +372,12 @@ static void PrintVersionInformation(JSONWriter* writer) { static void PrintJavaScriptStack(JSONWriter* writer, Isolate* isolate, Local stackstr, - const char* location) { + const char* trigger) { writer->json_objectstart("javascriptStack"); std::string ss; - if ((!strcmp(location, "OnFatalError")) || - (!strcmp(location, "Signal"))) { + if ((!strcmp(trigger, "FatalError")) || + (!strcmp(trigger, "Signal"))) { ss = "No stack.\nUnavailable.\n"; } else { String::Utf8Value sv(isolate, stackstr); diff --git a/src/node_report.h b/src/node_report.h index 2aa55151d87dca..7d36557e669048 100644 --- a/src/node_report.h +++ b/src/node_report.h @@ -43,13 +43,13 @@ typedef struct tm TIME_TYPE; std::string TriggerNodeReport(v8::Isolate* isolate, node::Environment* env, const char* message, - const char* location, + const char* trigger, std::string name, v8::Local stackstr); void GetNodeReport(v8::Isolate* isolate, node::Environment* env, const char* message, - const char* location, + const char* trigger, v8::Local stackstr, std::ostream& out); diff --git a/test/common/report.js b/test/common/report.js index c544cd86787fab..5655602fe81f5d 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -58,7 +58,7 @@ function _validateContent(data) { // Verify the format of the header section. const header = report.header; - const headerFields = ['event', 'location', 'filename', 'dumpEventTime', + const headerFields = ['event', 'trigger', 'filename', 'dumpEventTime', 'dumpEventTimeStamp', 'processId', 'commandLine', 'nodejsVersion', 'wordSize', 'arch', 'platform', 'componentVersions', 'release', 'osName', 'osRelease', @@ -66,7 +66,7 @@ function _validateContent(data) { 'glibcVersionCompiler']; checkForUnknownFields(header, headerFields); assert.strictEqual(typeof header.event, 'string'); - assert.strictEqual(typeof header.location, 'string'); + assert.strictEqual(typeof header.trigger, 'string'); assert(typeof header.filename === 'string' || header.filename === null); assert.notStrictEqual(new Date(header.dumpEventTime).toString(), 'Invalid Date');