shelly-script-examples icon indicating copy to clipboard operation
shelly-script-examples copied to clipboard

Minor error in example remoterpc.js

Open KDYR opened this issue 2 years ago • 0 comments

I think that in line 54 the parameter error_message should be error_code to reflect the argument in the declaration of the function in line 53. ...and similarly for line 62 and 61.

Another matter - just a suggestion: Regarding lines 23-25: These lines rely on the variable result being an object with certain properties. However, if Shelly.call, which is executing the callback code fails - e.g. because the remote Shelly device is temporarily unavailable (e.g. WiFi being down) - result is null or undefined and the script will stall. The example code works for illustration of certain aspects, but perhaps a note/comment to add error handling in a "production environment" would be an idea?

KDYR avatar Apr 18 '23 17:04 KDYR