thejsj / rethinkdb-init

Create all RethinkDB databases, tables and indexes automatically through a schema object.
https://www.npmjs.com/package/rethinkdb-init
53 stars 15 forks source link

Capturing errors in connection #12

Closed rupertbg closed 8 years ago

rupertbg commented 8 years ago

Is there a way to capture errors e.g. from .then(error, connection .. ?

thejsj commented 8 years ago

All functions here return a Promise. That means that you can use Promise.catch to capture errors.

r.init(opts)
.then(function (conn) {
  // All tables and indexes have been created
})
.catch(function (err) {
  // Retry????
});

Closing this issue, but happy to reopen it if there's anything else.