Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mikronode is listening to process events #98

Open
mint-dewit opened this issue Mar 4, 2020 · 0 comments
Open

Mikronode is listening to process events #98

mint-dewit opened this issue Mar 4, 2020 · 0 comments

Comments

@mint-dewit
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant