GeezerVison is showing github.com — report: rename triggerReport() to writeReport() by cjihrig · Pull Request #26527 · nodejs/node
report: rename triggerReport() to writeReport()
#26527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from all commits
Commits
File filter
Filter by extension
.cc
(1)
.h
(1)
.js
(3)
.md
(2)
All 4 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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
-->
Expand All
@@ -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][].
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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
Expand All
@@ -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
```
Expand Down
Expand Up
@@ -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
>
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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.
}
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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;
Expand All
@@ -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)
Expand Down
Expand Up
@@ -101,7 +101,7 @@ function removeSignalHandler() {
}
function signalHandler(sig) {
nr.triggerReport (sig, 'Signal', null, '');
nr.writeReport (sig, 'Signal', null, '');
}
module.exports = {
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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);
Expand Down
Expand Up
@@ -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);
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -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');
Expand All
@@ -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');
Expand All
@@ -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);
Expand All
@@ -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);
Expand All
@@ -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);
Expand All
@@ -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);
Expand Down
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.