Create a feathers app and configure the sync module, but do not have your mongo instance running.
import feathers from 'feathers';
import sync from 'feathers-sync';
const app = feathers().configure(sync({db: 'mongodb://localhost:27017/sync'}));
node_modules/mongodb-core/lib/topologies/server.js:321
return self.emit('error', new MongoError(f('failed to connect to server [%s] on first connect', self.name)));
^
MongoError: failed to connect to server [localhost:27017] on first connect
Use case 2 / 2:
Kill the mongo server after you've started your feathers application process. Console log below:
node_modules/mongodb-core/lib/error.js:29
err = new MongoError(options);
^
MongoError: connection 0 to localhost:27017 closed
Expected behavior
The server should be able to recover from this behavior. A catchable error should be thrown.
Actual behavior
Since the mubsub client implementation is an isolated implementation detail (https://github.com/feathersjs/feathers-sync/blob/master/src/mongodb.js#L7), I can't add an error hook in my code. So when the app can't connect to mongodb on startup, or if the connection to mongo is closed, the error bubbles up and the process crashes.
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
Steps to reproduce
Use case 1 / 2:
Create a feathers app and configure the sync module, but do not have your mongo instance running.
Use case 2 / 2:
Kill the mongo server after you've started your feathers application process. Console log below:
Expected behavior
The server should be able to recover from this behavior. A catchable error should be thrown.
Actual behavior
Since the
mubsub
client implementation is an isolated implementation detail (https://github.com/feathersjs/feathers-sync/blob/master/src/mongodb.js#L7), I can't add an error hook in my code. So when the app can't connect to mongodb on startup, or if the connection to mongo is closed, the error bubbles up and the process crashes.System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
feathers-sync@0.1.2 feathers@2.0.2
NodeJS version: 6.0.0