Commit dd20e68
committed
process: add optional detail to process emitWarning
Adds a new method signature variant for process.emitWarning()
that accepts an options object. The options object may include
a new `detail` option that allows additional detail text to be
associated with the warning. By default, this additional text
will be printed to stderr along with the warning, and included
on the Warning Error object using the `.detail` property.
e.g.
```js
process.emitWarning('A message', {
code: 'WARNING123',
detail: 'This is additional detail'
});
// Emits:
// (node {pid}) [WARNING123] Warning: A message
// This is additional detail
```
PR-URL: #12725
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>1 parent 23fc082 commit dd20e68Copy full SHA for dd20e68
File tree
Expand file treeCollapse file tree
3 files changed
+107
-36
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal/process
- test/parallel
Expand file treeCollapse file tree
3 files changed
+107
-36
lines changedOpen diff view settings
Collapse file
+51-5Lines changed: 51 additions & 5 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
637 | 637 | |
638 | 638 | |
639 | 639 | |
| 640 | + |
| 641 | + |
| 642 | + |
| 643 | + |
| 644 | + |
| 645 | + |
| 646 | + |
| 647 | + |
| 648 | + |
| 649 | + |
| 650 | + |
| 651 | + |
| 652 | + |
| 653 | + |
| 654 | + |
| 655 | + |
| 656 | + |
| 657 | + |
| 658 | + |
| 659 | + |
| 660 | + |
| 661 | + |
| 662 | + |
| 663 | + |
| 664 | + |
| 665 | + |
| 666 | + |
| 667 | + |
| 668 | + |
| 669 | + |
| 670 | + |
| 671 | + |
| 672 | + |
| 673 | + |
| 674 | + |
| 675 | + |
| 676 | + |
| 677 | + |
| 678 | + |
| 679 | + |
| 680 | + |
| 681 | + |
| 682 | + |
| 683 | + |
| 684 | + |
| 685 | + |
640 | 686 | |
641 | 687 | |
642 | 688 | |
| ||
655 | 701 | |
656 | 702 | |
657 | 703 | |
658 | | - |
| 704 | + |
659 | 705 | |
660 | 706 | |
661 | 707 | |
662 | 708 | |
663 | 709 | |
664 | | - |
| 710 | + |
665 | 711 | |
666 | 712 | |
667 | 713 | |
| ||
689 | 735 | |
690 | 736 | |
691 | 737 | |
692 | | - |
693 | | - |
| 738 | + |
| 739 | + |
694 | 740 | |
695 | 741 | |
696 | 742 | |
697 | 743 | |
698 | 744 | |
699 | | - |
| 745 | + |
700 | 746 | |
701 | 747 | |
702 | 748 | |
|
Collapse file
lib/internal/process/warning.js
Copy file name to clipboardExpand all lines: lib/internal/process/warning.js+19-11Lines changed: 19 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
90 | 90 | |
91 | 91 | |
92 | 92 | |
| 93 | + |
| 94 | + |
| 95 | + |
93 | 96 | |
94 | | - |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
| 97 | + |
99 | 98 | |
100 | 99 | |
101 | 100 | |
102 | 101 | |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
| 102 | + |
108 | 103 | |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
109 | 108 | |
110 | 109 | |
111 | 110 | |
112 | 111 | |
113 | 112 | |
| 113 | + |
114 | 114 | |
115 | 115 | |
116 | | - |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
117 | 124 | |
118 | 125 | |
119 | 126 | |
| ||
130 | 137 | |
131 | 138 | |
132 | 139 | |
| 140 | + |
133 | 141 | |
134 | 142 | |
135 | 143 | |
|
Collapse file
test/parallel/test-process-emitwarning.js
Copy file name to clipboardExpand all lines: test/parallel/test-process-emitwarning.js+37-20Lines changed: 37 additions & 20 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | | - |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
8 | 12 | |
9 | 13 | |
10 | 14 | |
11 | 15 | |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
28 | 29 | |
29 | | - |
30 | | - |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
31 | 49 | |
32 | 50 | |
33 | 51 | |
| ||
47 | 65 | |
48 | 66 | |
49 | 67 | |
50 | | - |
51 | 68 | |
52 | 69 | |
53 | 70 | |
|
0 commit comments