xref: /third_party/node/deps/npm/node_modules/tar/lib/warn-mixin.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/deps/npm/node_modules/tar/lib/
11cb0ef41Sopenharmony_ci'use strict'
21cb0ef41Sopenharmony_cimodule.exports = Base => class extends Base {
31cb0ef41Sopenharmony_ci  warn (code, message, data = {}) {
41cb0ef41Sopenharmony_ci    if (this.file) {
51cb0ef41Sopenharmony_ci      data.file = this.file
61cb0ef41Sopenharmony_ci    }
71cb0ef41Sopenharmony_ci    if (this.cwd) {
81cb0ef41Sopenharmony_ci      data.cwd = this.cwd
91cb0ef41Sopenharmony_ci    }
101cb0ef41Sopenharmony_ci    data.code = message instanceof Error && message.code || code
111cb0ef41Sopenharmony_ci    data.tarCode = code
121cb0ef41Sopenharmony_ci    if (!this.strict && data.recoverable !== false) {
131cb0ef41Sopenharmony_ci      if (message instanceof Error) {
141cb0ef41Sopenharmony_ci        data = Object.assign(message, data)
151cb0ef41Sopenharmony_ci        message = message.message
161cb0ef41Sopenharmony_ci      }
171cb0ef41Sopenharmony_ci      this.emit('warn', data.tarCode, message, data)
181cb0ef41Sopenharmony_ci    } else if (message instanceof Error) {
191cb0ef41Sopenharmony_ci      this.emit('error', Object.assign(message, data))
201cb0ef41Sopenharmony_ci    } else {
211cb0ef41Sopenharmony_ci      this.emit('error', Object.assign(new Error(`${code}: ${message}`), data))
221cb0ef41Sopenharmony_ci    }
231cb0ef41Sopenharmony_ci  }
241cb0ef41Sopenharmony_ci}
25

Indexes created Thu Nov 07 10:32:03 CST 2024