(rawErr, opts)
| 369 | } |
| 370 | |
| 371 | #getError (rawErr, opts) { |
| 372 | const { files = [], ...error } = require('./utils/error-message.js').getError(rawErr, { |
| 373 | npm: this, |
| 374 | command: this.#command, |
| 375 | ...opts, |
| 376 | }) |
| 377 | |
| 378 | const { writeFileSync } = require('node:fs') |
| 379 | for (const [file, content] of files) { |
| 380 | const filePath = `${this.logPath}${file}` |
| 381 | const fileContent = `'Log files:\n${this.logFiles.join('\n')}\n\n${content.trim()}\n` |
| 382 | try { |
| 383 | writeFileSync(filePath, fileContent) |
| 384 | error.detail.push(['', `\n\nFor a full report see:\n${filePath}`]) |
| 385 | } catch (fileErr) { |
| 386 | log.warn('', `Could not write error message to ${file} due to ${fileErr}`) |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | outputError(error) |
| 391 | |
| 392 | return error |
| 393 | } |
| 394 | |
| 395 | get title () { |
| 396 | return this.#title |
no test coverage detected