Skip to content

Commit e48f2aa

Browse files
committed
fix(MongoInstance::stop): silence "ECONNRESET" errors on shutdown
fixes #900 re #946
1 parent 232cec0 commit e48f2aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/mongodb-memory-server-core/src/util/MongoInstance.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,10 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
464464
!(
465465
err instanceof MongoNetworkError &&
466466
/^connection \d+ to [\d.]+:\d+ closed$/i.test(err.message)
467-
)
467+
) &&
468+
// "Connection Reset" may happen in the middle of the operation, for whatever reason before the command finishes,
469+
// this is not a error we need to log. (re https://github.com/typegoose/mongodb-memory-server/issues/900)
470+
!(err instanceof Error && 'read ECONNRESET' === err.message)
468471
) {
469472
console.warn(err);
470473
}

0 commit comments

Comments
 (0)