return error message on missing argument 'state'
This commit is contained in:
parent
99c588ac13
commit
4c7654722d
1 changed files with 3 additions and 1 deletions
|
@ -18,7 +18,9 @@ async function setServiceState(name, args) {
|
||||||
}
|
}
|
||||||
let state = args.get('state');
|
let state = args.get('state');
|
||||||
if (state === undefined) {
|
if (state === undefined) {
|
||||||
return;
|
const msg = 'missing argument \'state\', pass either \'active\', \'inactive\' or \'toggle\'';
|
||||||
|
logger.debug(msg);
|
||||||
|
return { err: msg };
|
||||||
}
|
}
|
||||||
if (state !== constants.SYSTEMD_STATE_ACTIVE && state !== constants.SYSTEMD_STATE_INACTIVE && state !== constants.SYSTEMD_STATE_TOGGLE) {
|
if (state !== constants.SYSTEMD_STATE_ACTIVE && state !== constants.SYSTEMD_STATE_INACTIVE && state !== constants.SYSTEMD_STATE_TOGGLE) {
|
||||||
const msg = 'can not set state of service \'' + name + '\' to unknown state \'' + state + '\'';
|
const msg = 'can not set state of service \'' + name + '\' to unknown state \'' + state + '\'';
|
||||||
|
|
Loading…
Reference in a new issue