How to use the emitWarning function from process

Find comprehensive JavaScript process.emitWarning code examples handpicked from public code repositorys.

39
40
41
42
43
44
45
46
47
// Process args
const args = process.argv.slice(2);

// Log a warning if there are more than 0 arguments
if (args.length > 0) {
  emitWarning(
    'No parameters needed, all the additional parameters will be ignored.',
  );
}
fork icon46
star icon47
watch icon10

26
27
28
29
30
31
32
33
34
35
};
if (options.flags) {
  parameters.flags = util.getFlagsString(options.flags);
}
if (options.hasOwnProperty('testMode')) {
  emitWarning(// eslint-disable-next-line max-len
    'The "testMode" parameter is deprecated, please use the "mode" parameter instead.',
  );
  parameters.mode = options.testMode === true ? 'test' : 'live';
} else if (options.hasOwnProperty('mode')) {
fork icon10
star icon41
watch icon19

36
37
38
39
40
41
42
43
44
45

enqueue (item) {
  const index = this.tail
  const size = this.opts.sizeCalculation(item)
  if (size > this.opts.maxSize) {
    emitWarning(`unable to enqueue item because item size ${size} is greater than maxSize ${this.opts.maxSize}`)
    return
  }
  this.sizes[index] = size
  const maxSize = this.opts.maxSize - size
fork icon17
star icon39
watch icon0

110
111
112
113
114
115
116
117
118

it("emitWarning", () => {
    var ev = new coroutine.Event();
    var warnings = [];

    process.emitWarning('Something happened!', {
        code: 'MY_WARNING',
        detail: 'This is some additional information',
    });
fork icon311
star icon0
watch icon0

17
18
19
20
21
22
23
24
      () => {}
    );
  }
  // Default is leave it as it is: Production.
})().catch((err) => {
  process.emitWarning(err);
  process.exitCode = 1;
});
fork icon1
star icon0
watch icon1