Skip to content

Commit

Permalink
fix: log mongoose connect error message
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRibbens committed Feb 15, 2021
1 parent c5d1e5c commit e36c7d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mongoose/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const connectMongoose = async (url: string, options: ConnectionOptions): Promise
};

if (process.env.NODE_ENV === 'test') {
// eslint-disable-next-line global-require
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
const { MongoMemoryServer } = require('mongodb-memory-server');
const mongod = new MongoMemoryServer({
instance: {
Expand All @@ -32,7 +32,7 @@ const connectMongoose = async (url: string, options: ConnectionOptions): Promise
await mongoose.connect(urlToConnect, connectionOptions);
logger.info(successfulConnectionMessage);
} catch (err) {
logger.error('Error: cannot connect to MongoDB. Details: ', err);
logger.error(`Error: cannot connect to MongoDB. Details: ${err.message}`, err);
process.exit(1);
}
};
Expand Down

0 comments on commit e36c7d2

Please sign in to comment.