summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/process.md4
-rw-r--r--doc/api/report.md12
-rw-r--r--lib/internal/process/execution.js8
-rw-r--r--lib/internal/process/report.js6
-rw-r--r--src/node_report.h2
-rw-r--r--src/node_report_module.cc5
-rw-r--r--test/report/test-report-writereport.js (renamed from test/report/test-report-triggerreport.js)22
7 files changed, 29 insertions, 30 deletions
diff --git a/doc/api/process.md b/doc/api/process.md
index 38825d88e6..f28e61ef97 100644
--- a/doc/api/process.md
+++ b/doc/api/process.md
@@ -1772,7 +1772,7 @@ The signal used to trigger the creation of a diagnostic report. Defaults to
console.log(`Report signal: ${process.report.signal}`);
```
-### process.report.triggerReport([filename][, err])
+### process.report.writeReport([filename][, err])
<!-- YAML
added: v11.8.0
-->
@@ -1790,7 +1790,7 @@ filename includes the date, time, PID, and a sequence number. The report's
JavaScript stack trace is taken from `err`, if present.
```js
-process.report.triggerReport();
+process.report.writeReport();
```
Additional documentation is available in the [report documentation][].
diff --git a/doc/api/report.md b/doc/api/report.md
index c371775eab..7cb3493953 100644
--- a/doc/api/report.md
+++ b/doc/api/report.md
@@ -404,14 +404,14 @@ written.
A report can also be triggered via an API call from a JavaScript application:
```js
-process.report.triggerReport();
+process.report.writeReport();
```
This function takes an optional additional argument `filename`, which is
the name of a file into which the report is written.
```js
-process.report.triggerReport('./foo.json');
+process.report.writeReport('./foo.json');
```
This function takes an optional additional argument `err` - an `Error` object
@@ -424,19 +424,19 @@ as where it was handled.
try {
process.chdir('/non-existent-path');
} catch (err) {
- process.report.triggerReport(err);
+ process.report.writeReport(err);
}
// Any other code
```
-If both filename and error object are passed to `triggerReport()` the
+If both filename and error object are passed to `writeReport()` the
error object must be the second parameter.
```js
try {
process.chdir('/non-existent-path');
} catch (err) {
- process.report.triggerReport(filename, err);
+ process.report.writeReport(filename, err);
}
// Any other code
```
@@ -470,7 +470,7 @@ triggered using the Node.js REPL:
```raw
$ node
-> process.report.triggerReport();
+> process.report.writeReport();
Writing Node.js report to file: report.20181126.091102.8480.001.json
Node.js report completed
>
diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js
index 310acc14b4..7118dbf3ad 100644
--- a/lib/internal/process/execution.js
+++ b/lib/internal/process/execution.js
@@ -110,10 +110,10 @@ function createFatalException() {
try {
const report = internalBinding('report');
if (report != null && report.shouldReportOnUncaughtException()) {
- report.triggerReport(er ? er.message : 'Exception',
- 'Exception',
- null,
- er ? er.stack : undefined);
+ report.writeReport(er ? er.message : 'Exception',
+ 'Exception',
+ null,
+ er ? er.stack : undefined);
}
} catch {} // Ignore the exception. Diagnostic reporting is unavailable.
}
diff --git a/lib/internal/process/report.js b/lib/internal/process/report.js
index c964431025..ff4e72f54c 100644
--- a/lib/internal/process/report.js
+++ b/lib/internal/process/report.js
@@ -7,7 +7,7 @@ const {
const { validateString } = require('internal/validators');
const nr = internalBinding('report');
const report = {
- triggerReport(file, err) {
+ writeReport(file, err) {
if (typeof file === 'object' && file !== null) {
err = file;
file = undefined;
@@ -19,7 +19,7 @@ const report = {
throw new ERR_INVALID_ARG_TYPE('err', 'Object', err);
}
- return nr.triggerReport('JavaScript API', 'API', file, err.stack);
+ return nr.writeReport('JavaScript API', 'API', file, err.stack);
},
getReport(err) {
if (err === undefined)
@@ -101,7 +101,7 @@ function removeSignalHandler() {
}
function signalHandler(sig) {
- nr.triggerReport(sig, 'Signal', null, '');
+ nr.writeReport(sig, 'Signal', null, '');
}
module.exports = {
diff --git a/src/node_report.h b/src/node_report.h
index 7aff7a5e2f..18135f5666 100644
--- a/src/node_report.h
+++ b/src/node_report.h
@@ -67,7 +67,7 @@ std::string ValueToHexString(T value) {
}
// Function declarations - export functions in src/node_report_module.cc
-void TriggerReport(const v8::FunctionCallbackInfo<v8::Value>& info);
+void WriteReport(const v8::FunctionCallbackInfo<v8::Value>& info);
void GetReport(const v8::FunctionCallbackInfo<v8::Value>& info);
// Node.js boot time - defined in src/node.cc
diff --git a/src/node_report_module.cc b/src/node_report_module.cc
index 202730d3b6..94894b0f5e 100644
--- a/src/node_report_module.cc
+++ b/src/node_report_module.cc
@@ -30,8 +30,7 @@ using v8::Object;
using v8::String;
using v8::Value;
-// External JavaScript API for triggering a report
-void TriggerReport(const FunctionCallbackInfo<Value>& info) {
+void WriteReport(const FunctionCallbackInfo<Value>& info) {
Environment* env = Environment::GetCurrent(info);
Isolate* isolate = env->isolate();
HandleScope scope(isolate);
@@ -161,7 +160,7 @@ static void Initialize(Local<Object> exports,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);
- env->SetMethod(exports, "triggerReport", TriggerReport);
+ env->SetMethod(exports, "writeReport", WriteReport);
env->SetMethod(exports, "getReport", GetReport);
env->SetMethod(exports, "getDirectory", GetDirectory);
env->SetMethod(exports, "setDirectory", SetDirectory);
diff --git a/test/report/test-report-triggerreport.js b/test/report/test-report-writereport.js
index c89959ae87..6c7ed8a71c 100644
--- a/test/report/test-report-triggerreport.js
+++ b/test/report/test-report-writereport.js
@@ -27,19 +27,19 @@ function validate() {
{
// Test with no arguments.
- process.report.triggerReport();
+ process.report.writeReport();
validate();
}
{
// Test with an error argument.
- process.report.triggerReport(new Error('test error'));
+ process.report.writeReport(new Error('test error'));
validate();
}
{
// Test with a file argument.
- const file = process.report.triggerReport('custom-name-1.json');
+ const file = process.report.writeReport('custom-name-1.json');
const absolutePath = path.join(tmpdir.path, file);
assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0);
assert.strictEqual(file, 'custom-name-1.json');
@@ -49,8 +49,8 @@ function validate() {
{
// Test with file and error arguments.
- const file = process.report.triggerReport('custom-name-2.json',
- new Error('test error'));
+ const file = process.report.writeReport('custom-name-2.json',
+ new Error('test error'));
const absolutePath = path.join(tmpdir.path, file);
assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0);
assert.strictEqual(file, 'custom-name-2.json');
@@ -61,7 +61,7 @@ function validate() {
{
// Test with a filename option.
process.report.filename = 'custom-name-3.json';
- const file = process.report.triggerReport();
+ const file = process.report.writeReport();
assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0);
const filename = path.join(process.report.directory, 'custom-name-3.json');
assert.strictEqual(file, process.report.filename);
@@ -72,21 +72,21 @@ function validate() {
// Test with an invalid file argument.
[null, 1, Symbol(), function() {}].forEach((file) => {
common.expectsError(() => {
- process.report.triggerReport(file);
+ process.report.writeReport(file);
}, { code: 'ERR_INVALID_ARG_TYPE' });
});
// Test with an invalid error argument.
[null, 1, Symbol(), function() {}, 'foo'].forEach((error) => {
common.expectsError(() => {
- process.report.triggerReport('file', error);
+ process.report.writeReport('file', error);
}, { code: 'ERR_INVALID_ARG_TYPE' });
});
{
// Test the special "stdout" filename.
const args = ['--experimental-report', '-e',
- 'process.report.triggerReport("stdout")'];
+ 'process.report.writeReport("stdout")'];
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
@@ -97,7 +97,7 @@ function validate() {
{
// Test the special "stderr" filename.
const args = ['--experimental-report', '-e',
- 'process.report.triggerReport("stderr")'];
+ 'process.report.writeReport("stderr")'];
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
@@ -113,7 +113,7 @@ function validate() {
const args = ['--experimental-report',
`--diagnostic-report-directory=${reportDir}`,
'-e',
- 'process.report.triggerReport()'];
+ 'process.report.writeReport()'];
const child = spawnSync(process.execPath, args, { cwd: tmpdir.path });
assert.strictEqual(child.status, 0);