MXS-1300: Return a rejected promise for unknown commands

When an unknow command is executed, the core should return a rejected
promise.
This commit is contained in:
Markus Mäkelä
2017-07-22 01:26:20 +03:00
parent 84dc0b2d37
commit 5edfe3040e
16 changed files with 66 additions and 35 deletions

View File

@ -31,8 +31,7 @@ exports.builder = function(yargs) {
})
} else {
maxctrl(argv, function() {
error('Invalid log priority: ' + argv.log)
return Promise.reject()
return error('Invalid log priority: ' + argv.log)
})
}
})
@ -43,7 +42,9 @@ exports.builder = function(yargs) {
})
.usage('Usage: disable <command>')
.help()
.command('*', 'the default command', {}, () => {
logger.log('Unknown command. See output of `help disable` for a list of commands.')
.command('*', 'the default command', {}, function(argv) {
maxctrl(argv, function(host) {
return error('Unknown command. See output of `help disable` for a list of commands.')
})
})
}