Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 96e47dd

Browse files
committed
refactor(uri-parser): update message for invalid auth source
1 parent bb08e58 commit 96e47dd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/uri_parser.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ function applyAuthExpectations(parsed) {
333333

334334
if (authMechanism === 'GSSAPI') {
335335
if (authSource != null && authSource !== '$external') {
336-
throw new MongoParseError(`Invalid auth source \`${authMechanism}\` specified`);
336+
throw new MongoParseError(
337+
`Invalid source \`${authSource}\` for mechanism \`${authMechanism}\` specified.`
338+
);
337339
}
338340

339341
parsed.auth = Object.assign({}, parsed.auth, { db: '$external' });
@@ -345,7 +347,9 @@ function applyAuthExpectations(parsed) {
345347
}
346348

347349
if (authSource != null && authSource !== '$external') {
348-
throw new MongoParseError(`Invalid auth source \`${authMechanism}\` specified`);
350+
throw new MongoParseError(
351+
`Invalid source \`${authSource}\` for mechanism \`${authMechanism}\` specified.`
352+
);
349353
}
350354

351355
parsed.auth = Object.assign({}, parsed.auth, { db: '$external' });

0 commit comments

Comments
 (0)