jdachtera / node-rtpmidi

A node js implementation of Apples Network Midi Protocol.
92 stars 17 forks source link

Cleaning pass + trycatch statement #18

Closed renaudfv closed 5 years ago

renaudfv commented 5 years ago

I'm using this module dynamically and need to create/destroy sessions from time to time. I have been using rtpmidi.manager.reset to do so but it seems problematic sometimes when the procedure restarts. I added a try-catch statement where it was the most problematic.

17 Jun 13:05:32 - Error [ERR_SOCKET_DGRAM_NOT_RUNNING]: Not running
    at Socket._healthCheck (dgram.js:638:11)
    at Socket.send (dgram.js:435:8)
    at Session.sendMessage [as sendUdpMessage] (/Users/.../Desktop/tmp/rtpmidi/node_modules/rtpmidi/src/Session.js:150:75)
    at Stream.sendReceiverFeedback (/Users/.../Desktop/tmp/rtpmidi/node_modules/rtpmidi/src/Stream.js:315:18)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)

I have linted most of the code for readability while adding Eslint.