Skip to content

Commit

Permalink
refactor: check err.code exists before checking if its in a set
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Aug 22, 2019
1 parent 4ec04f0 commit dbfe4f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/core/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function isNotMasterError(err) {
}

function isNodeShuttingDownError(err) {
return SDAM_NODE_SHUTTING_DOWN_ERROR_CODES.has(err.code);
return err.code && SDAM_NODE_SHUTTING_DOWN_ERROR_CODES.has(err.code);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion test/functional/connections_stepdown_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const chai = require('chai');
const expect = chai.expect;

function ignoreNsNotFound(err) {
if (!err.message.match(/ns not found/)) throw err;
if (!err.message.match(/ns not found/)) {
throw err;
}
}

function connectionCount(db) {
Expand Down

0 comments on commit dbfe4f5

Please sign in to comment.