cayasso / mongo-oplog

Watch mongodb oplog in a simple way
380 stars 91 forks source link

Omit throwing mongodb client error since there is no way to catch exceptions upstream #50

Closed andreagentili closed 7 years ago

andreagentili commented 7 years ago

When mongodb native client has an error, the error is emitted to .on('error' manager but it's even thrown, and there is no way to catch it (node exits abruptly). To fix the issue I just commented this line: https://github.com/cayasso/mongo-oplog/blob/master/src/index.js#L110. All tests are still passing.

4Z4T4R commented 7 years ago

I'm experiencing a similar issue related to timeouts... I can't seem to catch them or do anything about them and my node app crashes.

/Users/foo/svr/node_modules/mongo-oplog/node_modules/mongodb/lib/utils.js:123 process.nextTick(function() { throw err; }); ^ MongoError: connection 0 to mongo.moo.com:27017 timed out at Function.MongoError.create (/Users/foo/svr/node_modules/mongodb-core/lib/error.js:29:11) at Socket. (/Users/foo/svr/node_modules/mongodb-core/lib/connection/connection.js:188:20) at Socket.g (events.js:292:16) at emitNone (events.js:86:13) at Socket.emit (events.js:185:7) at Socket._onTimeout (net.js:338:8) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5)