Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
697 bytes
|
Line | |
---|
1 | 'use strict'
|
---|
2 | module.exports = Base => class extends Base {
|
---|
3 | warn (code, message, data = {}) {
|
---|
4 | if (this.file)
|
---|
5 | data.file = this.file
|
---|
6 | if (this.cwd)
|
---|
7 | data.cwd = this.cwd
|
---|
8 | data.code = message instanceof Error && message.code || code
|
---|
9 | data.tarCode = code
|
---|
10 | if (!this.strict && data.recoverable !== false) {
|
---|
11 | if (message instanceof Error) {
|
---|
12 | data = Object.assign(message, data)
|
---|
13 | message = message.message
|
---|
14 | }
|
---|
15 | this.emit('warn', data.tarCode, message, data)
|
---|
16 | } else if (message instanceof Error)
|
---|
17 | this.emit('error', Object.assign(message, data))
|
---|
18 | else
|
---|
19 | this.emit('error', Object.assign(new Error(`${code}: ${message}`), data))
|
---|
20 | }
|
---|
21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.