Skip to content

Mikronode is listening to process events #98

@mint-dewit

Description

@mint-dewit

In Util.js:338 the Mikronode library is listening for the process event unhandledRejection and parsing these rejections under the assumption that all events come from the Mikronode library. This makes issues like bitfocus/companion-module-bmd-hyperdeck#19 hard to debug.

process.on('unhandledRejection',function(event,promise){

Whenever a promise outside of the mikronode library is rejected but unhandled this listener will catch this. This is bad because the application developer loses control over how some parts of the application are handled and also because this listener makes the assumption a reason for rejection is always given. When this is not the case, the rejection handler in the mikronode library causes a new error because it tries to access event.cmd (where event is undefined)

A first course of action could be to add a check if event is defined before accessing any properties. E.g. changing line 139 to if (event && event.cmd) return;, this will at least not throw any new errors.

Ultimately the library should not handle process events at all in my opinion, as this should be done by the application itself and the library can make no assumptions about what other code will be running in the process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions