Closed GeoffreyPlitt closed 5 years ago
I was able to hack something like this by overriding Term.prototype.then
:
import Term from 'rethinkdbdash/lib/term'
Term.prototype.then = function (resolve, reject) {
return this.run().catch(err => {
// your logic here, or:
return Promise.reject(err)
}).then(resolve, reject)
}
I have per-query error handling as you would expect in my NodeJS rethinkdb app.
However, once in a while, my database becomes unreachable and a bunch of different queries in different places (i.e. queues and other background workers) all get the "ReqlDriverError: None of the pools have an opened connection and failed to open a new one. " error, and never seem to recover properly. But a simple restart seems to fix this.
So, I'd love if I could setup
on('error',...)
handling at the driver/connect level, so that in a single place, I could setup aprocess.exit()
when this happens. I wouldn't want to put this kind of error handling at every point where I'm doing queries, just once at the driver level.Is this possible?