zwave-js / node-red-contrib-zwave-js

The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.
MIT License
47 stars 6 forks source link

Bugfix proper logger fn ref #18

Closed hufftheweevil closed 3 years ago

hufftheweevil commented 3 years ago

This fixes a (pretty significant) bug that currently crashes Node-RED if the node is unable to list serial ports.

ReferenceError: node is not defined
    at /config/node-red/node_modules/node-red-contrib-zwave-js/zwave-js/zwave-js.js:436:17
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

The code cannot reference node because it is outside its scope. We can use RED.eventLog.log(), as used in this PR. Or you can go with a console.log() or console.error()