File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable no-param-reassign, no-console */
12import mongoose , { Schema } from 'mongoose' ;
23
34function getRandomInt ( min , max ) {
@@ -15,19 +16,20 @@ mongoose.connection.on('error', (err) => {
1516} ) ;
1617
1718mongoose . connection . on ( 'connected' , ( ) => {
18- console . log ( ' Mongoose default connection open to ' + uri ) ;
19+ console . log ( ` Mongoose default connection open to ${ uri } ` ) ;
1920} ) ;
2021
2122function dropDBs ( done ) {
22- mongoose . connection . db . dropDatabase ( ( ) => {
23- if ( done ) {
24- done ( ) ;
25- }
26- } ) ;
23+ try {
24+ mongoose . connection . db . dropDatabase ( ( ) => {
25+ if ( done ) done ( ) ;
26+ } ) ;
27+ } catch ( e ) { // Pitty, but not deathly
28+ if ( done ) done ( ) ;
29+ }
2730}
2831
2932process . on ( 'exit' , ( ) => { dropDBs ( ) ; } ) ;
30- process . on ( 'uncaughtException' , ( ) => { dropDBs ( ) ; } ) ;
3133process . on ( 'SIGINT' , ( ) => { dropDBs ( ) ; } ) ;
3234
3335export {
You can’t perform that action at this time.
0 commit comments