Closed MartinBucko closed 6 years ago
Thank you.
A basic goal of the generator is to remain source compatible with feathersjs.cli, which does not log such connection failures.
I've asked around and found that some people do modify this particular feathersjs/cli code. I'm proposing the code be changed to:
mongoose.Promise = global.Promise
mongoose.connect(app.get('mongodb'), {})
.then(({ connection }) => {
console.log(`connected to "${connection.name}" database at ${connection.host}:${connection.port}`)
return connection
})
.catch(error => {
console.log(error)
process.exit(0)
})
app.set('mongooseClient', mongoose)
Comments?
The TS version needs
.then(({ connection }: any) => {
Published in @feathers-plus/cli v0.4.24 using generator v0.2.30.
Steps to reproduce
I ship my app first time to production server and accidentally setup bad mongodb config URL. In logs it don't show nothing only message
Unhandled Rejection at: Promise ..
. It was hard to find the problem in bad password setup in mongodb URL. After this i foundmongoose.connect
don't have catch statement.Expected behavior
mongose.connect
should throw error after connection failIn generated file from cli
src/mongoose.js
should be:Module versions (especially the part that's not working):
feathers-plus cli version 0.4.23