coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.79k stars 358 forks source link

`wrapper.js` stability - adding global error handlers #219

Closed NitayRabi closed 4 years ago

NitayRabi commented 6 years ago

Issue - servicename.err.log outputs logs indicating wrapper.js process/server errors stopping the whole process - e.g

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at _errnoException (util.js:1022:11)
    at TCP.onread (net.js:615:25)

To handle these issues i suggest adding -

let server = require('net').createServer().listen();
server.on('error', (err) => {
    launch('warn', err.message);
    server = require('net').createServer().listen();
});
process.on('uncaughtException', (err) => {
    launch('warn', err.message);
});
NitayRabi commented 6 years ago

220 - @coreybutler

coreybutler commented 4 years ago

Obviously I haven't been maintain this for awhile. I merged your PR and it's in 1.0.0-beta.1, thank you!