| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0f8d8d6 commit 74ab1aa
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1772,7 +1772,7 @@ The signal used to trigger the creation of a diagnostic report. Defaults to | |||
| 1772 | 1772 | console.log(`Report signal: ${process.report.signal}`); | |
| 1773 | 1773 | ``` | |
| 1774 | 1774 | ||
| 1775 | - ### process.report.triggerReport([filename][, err]) | ||
| 1775 | + ### process.report.writeReport([filename][, err]) | ||
| 1776 | 1776 | <!-- YAML | |
| 1777 | 1777 | added: v11.8.0 | |
| 1778 | 1778 | --> | |
@@ -1790,7 +1790,7 @@ filename includes the date, time, PID, and a sequence number. The report's | |||
| 1790 | 1790 | JavaScript stack trace is taken from `err`, if present. | |
| 1791 | 1791 | ||
| 1792 | 1792 | ```js | |
| 1793 | - process.report.triggerReport(); | ||
| 1793 | + process.report.writeReport(); | ||
| 1794 | 1794 | ``` | |
| 1795 | 1795 | ||
| 1796 | 1796 | Additional documentation is available in the [report documentation][]. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -404,14 +404,14 @@ written. | |||
| 404 | 404 | A report can also be triggered via an API call from a JavaScript application: | |
| 405 | 405 | ||
| 406 | 406 | ```js | |
| 407 | - process.report.triggerReport(); | ||
| 407 | + process.report.writeReport(); | ||
| 408 | 408 | ``` | |
| 409 | 409 | ||
| 410 | 410 | This function takes an optional additional argument `filename`, which is | |
| 411 | 411 | the name of a file into which the report is written. | |
| 412 | 412 | ||
| 413 | 413 | ```js | |
| 414 | - process.report.triggerReport('./foo.json'); | ||
| 414 | + process.report.writeReport('./foo.json'); | ||
| 415 | 415 | ``` | |
| 416 | 416 | ||
| 417 | 417 | This function takes an optional additional argument `err` - an `Error` object | |
@@ -424,19 +424,19 @@ as where it was handled. | |||
| 424 | 424 | try { | |
| 425 | 425 | process.chdir('/non-existent-path'); | |
| 426 | 426 | } catch (err) { | |
| 427 | - process.report.triggerReport(err); | ||
| 427 | + process.report.writeReport(err); | ||
| 428 | 428 | } | |
| 429 | 429 | // Any other code | |
| 430 | 430 | ``` | |
| 431 | 431 | ||
| 432 | - If both filename and error object are passed to `triggerReport()` the | ||
| 432 | + If both filename and error object are passed to `writeReport()` the | ||
| 433 | 433 | error object must be the second parameter. | |
| 434 | 434 | ||
| 435 | 435 | ```js | |
| 436 | 436 | try { | |
| 437 | 437 | process.chdir('/non-existent-path'); | |
| 438 | 438 | } catch (err) { | |
| 439 | - process.report.triggerReport(filename, err); | ||
| 439 | + process.report.writeReport(filename, err); | ||
| 440 | 440 | } | |
| 441 | 441 | // Any other code | |
| 442 | 442 | ``` | |
@@ -470,7 +470,7 @@ triggered using the Node.js REPL: | |||
| 470 | 470 | ||
| 471 | 471 | ```raw | |
| 472 | 472 | $ node | |
| 473 | - > process.report.triggerReport(); | ||
| 473 | + > process.report.writeReport(); | ||
| 474 | 474 | Writing Node.js report to file: report.20181126.091102.8480.001.json | |
| 475 | 475 | Node.js report completed | |
| 476 | 476 | > | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,10 +110,10 @@ function createFatalException() { | |||
| 110 | 110 | try { | |
| 111 | 111 | const report = internalBinding('report'); | |
| 112 | 112 | if (report != null && report.shouldReportOnUncaughtException()) { | |
| 113 | - report.triggerReport(er ? er.message : 'Exception', | ||
| 114 | - 'Exception', | ||
| 115 | - null, | ||
| 116 | - er ? er.stack : undefined); | ||
| 113 | + report.writeReport(er ? er.message : 'Exception', | ||
| 114 | + 'Exception', | ||
| 115 | + null, | ||
| 116 | + er ? er.stack : undefined); | ||
| 117 | 117 | } | |
| 118 | 118 | } catch {} // Ignore the exception. Diagnostic reporting is unavailable. | |
| 119 | 119 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,7 @@ const { | |||
| 7 | 7 | const { validateString } = require('internal/validators'); | |
| 8 | 8 | const nr = internalBinding('report'); | |
| 9 | 9 | const report = { | |
| 10 | - triggerReport(file, err) { | ||
| 10 | + writeReport(file, err) { | ||
| 11 | 11 | if (typeof file === 'object' && file !== null) { | |
| 12 | 12 | err = file; | |
| 13 | 13 | file = undefined; | |
@@ -19,7 +19,7 @@ const report = { | |||
| 19 | 19 | throw new ERR_INVALID_ARG_TYPE('err', 'Object', err); | |
| 20 | 20 | } | |
| 21 | 21 | ||
| 22 | - return nr.triggerReport('JavaScript API', 'API', file, err.stack); | ||
| 22 | + return nr.writeReport('JavaScript API', 'API', file, err.stack); | ||
| 23 | 23 | }, | |
| 24 | 24 | getReport(err) { | |
| 25 | 25 | if (err === undefined) | |
@@ -101,7 +101,7 @@ function removeSignalHandler() { | |||
| 101 | 101 | } | |
| 102 | 102 | ||
| 103 | 103 | function signalHandler(sig) { | |
| 104 | - nr.triggerReport(sig, 'Signal', null, ''); | ||
| 104 | + nr.writeReport(sig, 'Signal', null, ''); | ||
| 105 | 105 | } | |
| 106 | 106 | ||
| 107 | 107 | module.exports = { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,7 +67,7 @@ std::string ValueToHexString(T value) { | |||
| 67 | 67 | } | |
| 68 | 68 | ||
| 69 | 69 | // Function declarations - export functions in src/node_report_module.cc | |
| 70 | - void TriggerReport(const v8::FunctionCallbackInfo<v8::Value>& info); | ||
| 70 | + void WriteReport(const v8::FunctionCallbackInfo<v8::Value>& info); | ||
| 71 | 71 | void GetReport(const v8::FunctionCallbackInfo<v8::Value>& info); | |
| 72 | 72 | ||
| 73 | 73 | // Node.js boot time - defined in src/node.cc | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,8 +30,7 @@ using v8::Object; | |||
| 30 | 30 | using v8::String; | |
| 31 | 31 | using v8::Value; | |
| 32 | 32 | ||
| 33 | - // External JavaScript API for triggering a report | ||
| 34 | - void TriggerReport(const FunctionCallbackInfo<Value>& info) { | ||
| 33 | + void WriteReport(const FunctionCallbackInfo<Value>& info) { | ||
| 35 | 34 | Environment* env = Environment::GetCurrent(info); | |
| 36 | 35 | Isolate* isolate = env->isolate(); | |
| 37 | 36 | HandleScope scope(isolate); | |
@@ -161,7 +160,7 @@ static void Initialize(Local<Object> exports, | |||
| 161 | 160 | Local<Context> context) { | |
| 162 | 161 | Environment* env = Environment::GetCurrent(context); | |
| 163 | 162 | ||
| 164 | - env->SetMethod(exports, "triggerReport", TriggerReport); | ||
| 163 | + env->SetMethod(exports, "writeReport", WriteReport); | ||
| 165 | 164 | env->SetMethod(exports, "getReport", GetReport); | |
| 166 | 165 | env->SetMethod(exports, "getDirectory", GetDirectory); | |
| 167 | 166 | env->SetMethod(exports, "setDirectory", SetDirectory); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,19 +27,19 @@ function validate() { | |||
| 27 | 27 | ||
| 28 | 28 | { | |
| 29 | 29 | // Test with no arguments. | |
| 30 | - process.report.triggerReport(); | ||
| 30 | + process.report.writeReport(); | ||
| 31 | 31 | validate(); | |
| 32 | 32 | } | |
| 33 | 33 | ||
| 34 | 34 | { | |
| 35 | 35 | // Test with an error argument. | |
| 36 | - process.report.triggerReport(new Error('test error')); | ||
| 36 | + process.report.writeReport(new Error('test error')); | ||
| 37 | 37 | validate(); | |
| 38 | 38 | } | |
| 39 | 39 | ||
| 40 | 40 | { | |
| 41 | 41 | // Test with a file argument. | |
| 42 | - const file = process.report.triggerReport('custom-name-1.json'); | ||
| 42 | + const file = process.report.writeReport('custom-name-1.json'); | ||
| 43 | 43 | const absolutePath = path.join(tmpdir.path, file); | |
| 44 | 44 | assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0); | |
| 45 | 45 | assert.strictEqual(file, 'custom-name-1.json'); | |
@@ -49,8 +49,8 @@ function validate() { | |||
| 49 | 49 | ||
| 50 | 50 | { | |
| 51 | 51 | // Test with file and error arguments. | |
| 52 | - const file = process.report.triggerReport('custom-name-2.json', | ||
| 53 | - new Error('test error')); | ||
| 52 | + const file = process.report.writeReport('custom-name-2.json', | ||
| 53 | + new Error('test error')); | ||
| 54 | 54 | const absolutePath = path.join(tmpdir.path, file); | |
| 55 | 55 | assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0); | |
| 56 | 56 | assert.strictEqual(file, 'custom-name-2.json'); | |
@@ -61,7 +61,7 @@ function validate() { | |||
| 61 | 61 | { | |
| 62 | 62 | // Test with a filename option. | |
| 63 | 63 | process.report.filename = 'custom-name-3.json'; | |
| 64 | - const file = process.report.triggerReport(); | ||
| 64 | + const file = process.report.writeReport(); | ||
| 65 | 65 | assert.strictEqual(helper.findReports(process.pid, tmpdir.path).length, 0); | |
| 66 | 66 | const filename = path.join(process.report.directory, 'custom-name-3.json'); | |
| 67 | 67 | assert.strictEqual(file, process.report.filename); | |
@@ -72,21 +72,21 @@ function validate() { | |||
| 72 | 72 | // Test with an invalid file argument. | |
| 73 | 73 | [null, 1, Symbol(), function() {}].forEach((file) => { | |
| 74 | 74 | common.expectsError(() => { | |
| 75 | - process.report.triggerReport(file); | ||
| 75 | + process.report.writeReport(file); | ||
| 76 | 76 | }, { code: 'ERR_INVALID_ARG_TYPE' }); | |
| 77 | 77 | }); | |
| 78 | 78 | ||
| 79 | 79 | // Test with an invalid error argument. | |
| 80 | 80 | [null, 1, Symbol(), function() {}, 'foo'].forEach((error) => { | |
| 81 | 81 | common.expectsError(() => { | |
| 82 | - process.report.triggerReport('file', error); | ||
| 82 | + process.report.writeReport('file', error); | ||
| 83 | 83 | }, { code: 'ERR_INVALID_ARG_TYPE' }); | |
| 84 | 84 | }); | |
| 85 | 85 | ||
| 86 | 86 | { | |
| 87 | 87 | // Test the special "stdout" filename. | |
| 88 | 88 | const args = ['--experimental-report', '-e', | |
| 89 | - 'process.report.triggerReport("stdout")']; | ||
| 89 | + 'process.report.writeReport("stdout")']; | ||
| 90 | 90 | const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | |
| 91 | 91 | assert.strictEqual(child.status, 0); | |
| 92 | 92 | assert.strictEqual(child.signal, null); | |
@@ -97,7 +97,7 @@ function validate() { | |||
| 97 | 97 | { | |
| 98 | 98 | // Test the special "stderr" filename. | |
| 99 | 99 | const args = ['--experimental-report', '-e', | |
| 100 | - 'process.report.triggerReport("stderr")']; | ||
| 100 | + 'process.report.writeReport("stderr")']; | ||
| 101 | 101 | const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | |
| 102 | 102 | assert.strictEqual(child.status, 0); | |
| 103 | 103 | assert.strictEqual(child.signal, null); | |
@@ -113,7 +113,7 @@ function validate() { | |||
| 113 | 113 | const args = ['--experimental-report', | |
| 114 | 114 | `--diagnostic-report-directory=${reportDir}`, | |
| 115 | 115 | '-e', | |
| 116 | - 'process.report.triggerReport()']; | ||
| 116 | + 'process.report.writeReport()']; | ||
| 117 | 117 | const child = spawnSync(process.execPath, args, { cwd: tmpdir.path }); | |
| 118 | 118 | ||
| 119 | 119 | assert.strictEqual(child.status, 0); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments