Thursday, 3 October 2019

how to handle disconnect error for MongoDB

I am seeing this uncaught exception in my Node.js process:

Uncaught exception: { Error: read ETIMEDOUT
    at TCP.onStreamRead (internal/stream_base_commons.js:162:27)
  name: 'MongoNetworkError',
  errorLabels: [ 'TransientTransactionError' ],
  [Symbol(mongoErrorContextSymbol)]: { isGetMore: true } }

I tried capturing/trapping it using:

import * as mdb from 'mongodb'
const d = new mdb.MongoClient(...);
d.on('error', () => {...});  // trap it here

but that does not seem to be able to trap the error. Anyone know how I can do so?



from how to handle disconnect error for MongoDB

No comments:

Post a Comment