OpenZWave / node-openzwave-shared

OpenZWave addon for Node.js (all versions) including management and security functions
Other
199 stars 113 forks source link

1.6 Critical Update - Catching Exceptions from OZW (node-openzwave-shared) #293

Closed Fishwaldo closed 5 years ago

Fishwaldo commented 5 years ago

As per the OZW 1.6 Release Notes, Exceptions are now used throughout OZW

Any calls to any OZW Methods (in any of the Classes, such as Manager, Options etc) now may raise a exception on errors.

Need to wrap these calls with a try...catch block and determine the best way to raise the error to the application.

The List of possible exceptions is in OZWException.h but expect it to potentially grow.

This is a potentially breaking change in OZW 1.6 Many applications that have attempted to migrate from 1.4 to 1.6 are getting caught out by this.

Ideally, exceptions should not happen at all, but as per the best guess I can make, applications, or wrappers are creating their own copies of ValueID's and passing them to OZW. Only OZW should create a ValueID, and applications/wrappers store the ValueID's as they are announced in the Notification ValueAdded Callback.

ekarak commented 5 years ago

Added a preprocessor macro to wrap all Manager calls and pass them on to JS-land as JS errors. This was initially implemented in branch 'feature/openzwave16' : https://github.com/OpenZWave/node-openzwave-shared/commit/bcab0d0e2b0ef9957df59f1b73b0736ef274a248#diff-f1b3a808d5362222a35a1857f5e0fa2eR24