db-migrate / mongodb

mongodb driver for db-migrate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Friendly handling of connection failure

RobertLowe opened this issue · comments

There's no handling for failure of the MongoClient, I purpose we add some.

Ex, if the mongo instance is down, the following is thrown:

[ERROR] TypeError: Cannot read property 'createCollection' of null
    at ./node_modules/db-migrate-mongodb/index.js:363:15
    at connectCallback (./node_modules/db-migrate-mongodb/node_modules/mongodb/lib/mongo_client.js:527:5)
    at ./node_modules/db-migrate-mongodb/node_modules/mongodb/lib/mongo_client.js:418:11
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

The other drivers do this:

https://github.com/db-migrate/mysql/blob/master/index.js#L508-L514

Cheers