st-one-io / node-open-protocol

This node is an implementation of the Atlas Copco's Open Protocol. This node was created by Smart-Tech as part of the ST-One project.
GNU General Public License v3.0
39 stars 38 forks source link

Add subscription error codes to mid groups #42

Open ferm10n opened 1 year ago

ferm10n commented 1 year ago

src/constants.js defines a mapping between error codes and a text message for what they represent.

Almost every subscription has at least two error codes, one for when the subscription already exists, and the other for when attempting to unsubscribe from a non-existent subscription.

This PR adds these error codes in the midGroups list, so it's possible for other libraries to know which mid group an error code corresponds to.

Additionally, error handling is added to prevent un/subscribing to mids that do not support that.