diff options
Diffstat (limited to 'workspaces/config/lib/errors.js')
-rw-r--r-- | workspaces/config/lib/errors.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/workspaces/config/lib/errors.js b/workspaces/config/lib/errors.js new file mode 100644 index 000000000..fa3e20798 --- /dev/null +++ b/workspaces/config/lib/errors.js @@ -0,0 +1,22 @@ +'use strict' + +class ErrInvalidAuth extends Error { + constructor (problems) { + let message = 'Invalid auth configuration found: ' + message += problems.map((problem) => { + if (problem.action === 'delete') { + return `\`${problem.key}\` is not allowed in ${problem.where} config` + } else if (problem.action === 'rename') { + return `\`${problem.from}\` must be renamed to \`${problem.to}\` in ${problem.where} config` + } + }).join(', ') + message += '\nPlease run `npm config fix` to repair your configuration.`' + super(message) + this.code = 'ERR_INVALID_AUTH' + this.problems = problems + } +} + +module.exports = { + ErrInvalidAuth, +} |