Skip to content

Commit 2908e63

Browse files
cjihrigBridgeAR
authored andcommitted
report: rename location to trigger
trigger more accurately describes the use of the field. Previously, location was just the name of the C++ function that called TriggerNodeReport(). PR-URL: #26386 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 3093617 commit 2908e63

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

doc/api/report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ is provided below for reference.
2323
{
2424
"header": {
2525
"event": "exception",
26-
"location": "OnUncaughtException",
26+
"trigger": "Exception",
2727
"filename": "report.20181221.005011.8974.001.json",
2828
"dumpEventTime": "2018-12-21T00:50:11Z",
2929
"dumpEventTimeStamp": "1545371411331",

src/node_errors.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void OnFatalError(const char* location, const char* message) {
318318
Environment* env = Environment::GetCurrent(isolate);
319319
if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) {
320320
report::TriggerNodeReport(
321-
isolate, env, message, __func__, "", Local<String>());
321+
isolate, env, message, "FatalError", "", Local<String>());
322322
}
323323
#endif // NODE_REPORT
324324
fflush(stderr);

src/node_report.cc

+12-12
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ using v8::Value;
7070
static void WriteNodeReport(Isolate* isolate,
7171
Environment* env,
7272
const char* message,
73-
const char* location,
73+
const char* trigger,
7474
const std::string& filename,
7575
std::ostream& out,
7676
Local<String> stackstr,
@@ -79,7 +79,7 @@ static void PrintVersionInformation(JSONWriter* writer);
7979
static void PrintJavaScriptStack(JSONWriter* writer,
8080
Isolate* isolate,
8181
Local<String> stackstr,
82-
const char* location);
82+
const char* trigger);
8383
static void PrintNativeStack(JSONWriter* writer);
8484
#ifndef _WIN32
8585
static void PrintResourceUsage(JSONWriter* writer);
@@ -100,7 +100,7 @@ static std::atomic_int seq = {0}; // sequence number for report filenames
100100
std::string TriggerNodeReport(Isolate* isolate,
101101
Environment* env,
102102
const char* message,
103-
const char* location,
103+
const char* trigger,
104104
std::string name,
105105
Local<String> stackstr) {
106106
std::ostringstream oss;
@@ -178,7 +178,7 @@ std::string TriggerNodeReport(Isolate* isolate,
178178
<< "Writing Node.js report to file: " << filename << std::endl;
179179
}
180180

181-
WriteNodeReport(isolate, env, message, location, filename, *outstream,
181+
WriteNodeReport(isolate, env, message, trigger, filename, *outstream,
182182
stackstr, &tm_struct);
183183

184184
// Do not close stdout/stderr, only close files we opened.
@@ -194,22 +194,22 @@ std::string TriggerNodeReport(Isolate* isolate,
194194
void GetNodeReport(Isolate* isolate,
195195
Environment* env,
196196
const char* message,
197-
const char* location,
197+
const char* trigger,
198198
Local<String> stackstr,
199199
std::ostream& out) {
200200
// Obtain the current time and the pid (platform dependent)
201201
TIME_TYPE tm_struct;
202202
LocalTime(&tm_struct);
203203
WriteNodeReport(
204-
isolate, env, message, location, "", out, stackstr, &tm_struct);
204+
isolate, env, message, trigger, "", out, stackstr, &tm_struct);
205205
}
206206

207207
// Internal function to coordinate and write the various
208208
// sections of the report to the supplied stream
209209
static void WriteNodeReport(Isolate* isolate,
210210
Environment* env,
211211
const char* message,
212-
const char* location,
212+
const char* trigger,
213213
const std::string& filename,
214214
std::ostream& out,
215215
Local<String> stackstr,
@@ -228,7 +228,7 @@ static void WriteNodeReport(Isolate* isolate,
228228
writer.json_objectstart("header");
229229

230230
writer.json_keyvalue("event", message);
231-
writer.json_keyvalue("location", location);
231+
writer.json_keyvalue("trigger", trigger);
232232
if (!filename.empty())
233233
writer.json_keyvalue("filename", filename);
234234
else
@@ -280,7 +280,7 @@ static void WriteNodeReport(Isolate* isolate,
280280
writer.json_objectend();
281281

282282
// Report summary JavaScript stack backtrace
283-
PrintJavaScriptStack(&writer, isolate, stackstr, location);
283+
PrintJavaScriptStack(&writer, isolate, stackstr, trigger);
284284

285285
// Report native stack backtrace
286286
PrintNativeStack(&writer);
@@ -372,12 +372,12 @@ static void PrintVersionInformation(JSONWriter* writer) {
372372
static void PrintJavaScriptStack(JSONWriter* writer,
373373
Isolate* isolate,
374374
Local<String> stackstr,
375-
const char* location) {
375+
const char* trigger) {
376376
writer->json_objectstart("javascriptStack");
377377

378378
std::string ss;
379-
if ((!strcmp(location, "OnFatalError")) ||
380-
(!strcmp(location, "Signal"))) {
379+
if ((!strcmp(trigger, "FatalError")) ||
380+
(!strcmp(trigger, "Signal"))) {
381381
ss = "No stack.\nUnavailable.\n";
382382
} else {
383383
String::Utf8Value sv(isolate, stackstr);

src/node_report.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ typedef struct tm TIME_TYPE;
4343
std::string TriggerNodeReport(v8::Isolate* isolate,
4444
node::Environment* env,
4545
const char* message,
46-
const char* location,
46+
const char* trigger,
4747
std::string name,
4848
v8::Local<v8::String> stackstr);
4949
void GetNodeReport(v8::Isolate* isolate,
5050
node::Environment* env,
5151
const char* message,
52-
const char* location,
52+
const char* trigger,
5353
v8::Local<v8::String> stackstr,
5454
std::ostream& out);
5555

test/common/report.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ function _validateContent(data) {
5858

5959
// Verify the format of the header section.
6060
const header = report.header;
61-
const headerFields = ['event', 'location', 'filename', 'dumpEventTime',
61+
const headerFields = ['event', 'trigger', 'filename', 'dumpEventTime',
6262
'dumpEventTimeStamp', 'processId', 'commandLine',
6363
'nodejsVersion', 'wordSize', 'arch', 'platform',
6464
'componentVersions', 'release', 'osName', 'osRelease',
6565
'osVersion', 'osMachine', 'host', 'glibcVersionRuntime',
6666
'glibcVersionCompiler'];
6767
checkForUnknownFields(header, headerFields);
6868
assert.strictEqual(typeof header.event, 'string');
69-
assert.strictEqual(typeof header.location, 'string');
69+
assert.strictEqual(typeof header.trigger, 'string');
7070
assert(typeof header.filename === 'string' || header.filename === null);
7171
assert.notStrictEqual(new Date(header.dumpEventTime).toString(),
7272
'Invalid Date');

0 commit comments

Comments
 (0)