New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No input validation for getForeignObjectAsync() and possibly similar functions #947
Comments
Hm there is a validation of the Id in getForeignObject since js-c 3.. ioBroker.js-controller/lib/adapter.js Line 2843 in 4975d2f
ioBroker.js-controller/lib/adapter.js Line 485 in 4975d2f
|
Thank you @foxriver76 for looking into this!
And this is the log:
I am using VS Code under Windows, if this has any relevance to this issue. |
Ah so you mean its not a real error which is thrown.. it is probably only a string in 3.1 but will be a real error in 3.2 So catching and logging only |
Ahhh... try to log error directly please ... In js-controller <3.2 (which will come in September 2020) the return could be a string and not in any case an Error object |
Thanks @Apollon77 and @foxriver76
the log is as follows:
|
thanks, I am having further questions and appreciate your response, see: https://forum.iobroker.net/topic/34569/adapter-error-handling-frage |
Hi :-)
Problem Statement:
If I call
const lpStateObject = await this._adapter.getForeignObjectAsync(lpStatePath);
so callinggetForeignObjectAsync()
without validating the input and providing an empty string:try()/catch() jumps into catch().
This happens if the parameter for getForeignObjectAsync() is an empty string.
Suggested Solution
Please add a validation of the input parameter and throw an error if not met. In my Smart Control adapter, I will be now using the following function within a class (quickly put together, not extensively tested, yet).
The text was updated successfully, but these errors were encountered: