1'use strict' 2 3class ErrInvalidAuth extends Error { 4 constructor (problems) { 5 let message = 'Invalid auth configuration found: ' 6 message += problems.map((problem) => { 7 // istanbul ignore else 8 if (problem.action === 'delete') { 9 return `\`${problem.key}\` is not allowed in ${problem.where} config` 10 } else if (problem.action === 'rename') { 11 return `\`${problem.from}\` must be renamed to \`${problem.to}\` in ${problem.where} config` 12 } 13 }).join(', ') 14 message += '\nPlease run `npm config fix` to repair your configuration.`' 15 super(message) 16 this.code = 'ERR_INVALID_AUTH' 17 this.problems = problems 18 } 19} 20 21module.exports = { 22 ErrInvalidAuth, 23} 24