Skip to content

Commit 55b08b5

Browse files
committed
refactor: better message for option validation
1 parent b2199a6 commit 55b08b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/connection_string.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,11 @@ export function parseOptions(
370370
allKeys,
371371
Array.from(Object.keys(OPTIONS)).map(s => s.toLowerCase())
372372
);
373+
const optionWord = unsupportedOptions.size > 1 ? 'options' : 'option';
374+
const isOrAre = unsupportedOptions.size > 1 ? 'are' : 'is';
373375
if (unsupportedOptions.size !== 0) {
374376
throw new MongoParseError(
375-
`options ${Array.from(unsupportedOptions).join(', ')} are not supported`
377+
`${optionWord} ${Array.from(unsupportedOptions).join(', ')} ${isOrAre} not supported`
376378
);
377379
}
378380

0 commit comments

Comments
 (0)