Skip to content

Commit

Permalink
only log that undefiend is invalid, because devs had no prev warning …
Browse files Browse the repository at this point in the history
…because it was bugged

- fallback to old yargs, because it requires node12
  • Loading branch information
foxriver76 committed May 2, 2021
1 parent 94552d9 commit ca8dc76
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 79 deletions.
16 changes: 12 additions & 4 deletions lib/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6090,7 +6090,9 @@ function Adapter(options) {

if (state.val === undefined && !Object.keys(state).length) {
// undefined is not allowed as state.val -> return
return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
this.log.info('undefined is not a valid state value')
// TODO: reactivate line below + test in in next controller version (02.05.2021)
// return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
}

if (ack !== undefined) {
Expand Down Expand Up @@ -6272,7 +6274,9 @@ function Adapter(options) {

if (state.val === undefined && !Object.keys(state).length) {
// undefined is not allowed as state.val -> return
return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
this.log.info('undefined is not a valid state value')
// TODO: reactivate line below + test in in next controller version (02.05.2021)
// return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
}

if (ack !== undefined) {
Expand Down Expand Up @@ -6372,7 +6376,9 @@ function Adapter(options) {

if (state.val === undefined && !Object.keys(state).length) {
// undefined is not allowed as state.val -> return
return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
this.log.info('undefined is not a valid state value')
// TODO: reactivate line below + test in in next controller version (02.05.2021)
// return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
}

if (ack !== undefined) {
Expand Down Expand Up @@ -6594,7 +6600,9 @@ function Adapter(options) {

if (state.val === undefined && !Object.keys(state).length) {
// undefined is not allowed as state.val -> return
return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
this.log.info('undefined is not a valid state value')
// TODO: reactivate line below + test in in next controller version (02.05.2021)
// return tools.maybeCallbackWithError(callback, 'undefined is not a valid state value');
}

if (ack !== undefined) {
Expand Down
82 changes: 8 additions & 74 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"tar": "^6.1.0",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.2",
"yargs": "^17.0.0"
"yargs": "^16.2.0"
},
"devDependencies": {
"@alcalzone/release-script": "^1.10.0",
Expand Down
3 changes: 3 additions & 0 deletions test/lib/testStates.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ function register(it, expect, context) {
});
});

/**
TODO: Reactivate with next controller (02.05.2021)
it(testName + 'Should decline undefined state value', async () => {
// set state to 1
await context.adapter.setStateAsync(`${gid}undefinedState`, 1);
Expand All @@ -870,6 +872,7 @@ function register(it, expect, context) {
}
}
});
*/

it(testName + 'Should also set object id', async () => {
// set state with device, channel, state
Expand Down

0 comments on commit ca8dc76

Please sign in to comment.