promised-mongo icon indicating copy to clipboard operation
promised-mongo copied to clipboard

Invalid connection crashes the process

Open seangenabe opened this issue 9 years ago • 0 comments

When trying to connect to a non-existent instance of MongoDB, it simply crashes. Consider this code:

(async function() {
  try {
    console.log('run')
    let db = await require('promised-mongo')('localhost')
    let test = db.collection('test')
    await test.insert({test: 1})
    console.log('done')
  }
  catch (err) {
    console.log('error')
  }
})()

When I run this without starting mongod first, it doesn't show error, it simply crashes. Is this to be expected?

seangenabe avatar Oct 16 '15 15:10 seangenabe