Throw 'not supported' errors for package specs not supported yet

This commit is contained in:
Rico Sta. Cruz
2016-01-30 04:16:28 +08:00
parent c36a67f19a
commit fbb461ec37
3 changed files with 11 additions and 1 deletions

View File

@@ -130,6 +130,9 @@ function logger () {
} else if (status === 'dependencies') {
t.status(chalk.gray('' + pkgData.version + ' ·'))
.details('')
} else if (status === 'error') {
t.status(chalk.red('ERROR ✗'))
.details(args && (args.message || args))
} else {
t.status(status)
.details('')

View File

@@ -1,10 +1,13 @@
var chalk = require('chalk')
module.exports = function err (error) {
console.error('')
if (error.host && error.path) {
console.error('' + error.message)
console.error('' + error.method + ' ' + error.host + error.path)
} else {
console.error('Error: ' + (error.stack || error.message || error))
console.error(chalk.red(' ! ' + (error.message || error)))
}
console.error('')
process.exit(1)
}

View File

@@ -63,6 +63,10 @@ module.exports = function install (ctx, pkgSpec, modules, options) {
fulldata: undefined
}
if (!pkg.spec.name) {
throw new Error("Not supported: '" + pkgSpec + "'")
}
var paths = {
// Module storage => './node_modules'
modules: modules,