diff --git a/src/language/markdown-language.js b/src/language/markdown-language.js index 12cc528b..0e414a96 100644 --- a/src/language/markdown-language.js +++ b/src/language/markdown-language.js @@ -185,7 +185,7 @@ export class MarkdownLanguage { !validFrontmatterOptions.has(frontmatterOption) ) { throw new Error( - `Invalid language option value \`${frontmatterOption}\` for frontmatter. Expected one of \`false\`, \`"yaml"\`, \`"toml"\`, or \`"json"\`.`, + `Invalid language option value \`${String(frontmatterOption)}\` for frontmatter. Expected one of \`false\`, \`"yaml"\`, \`"toml"\`, or \`"json"\`.`, ); } @@ -194,7 +194,7 @@ export class MarkdownLanguage { if (mathOption !== undefined && typeof mathOption !== "boolean") { throw new Error( - `Invalid language option value \`${mathOption}\` for math. Expected a boolean.`, + `Invalid language option value \`${String(mathOption)}\` for math. Expected a boolean.`, ); } } diff --git a/tests/language/markdown-language.test.js b/tests/language/markdown-language.test.js index b9c5c4cf..9b8654fa 100644 --- a/tests/language/markdown-language.test.js +++ b/tests/language/markdown-language.test.js @@ -58,6 +58,17 @@ describe("MarkdownLanguage", () => { 'Invalid language option value `123` for frontmatter. Expected one of `false`, `"yaml"`, `"toml"`, or `"json"`.', }, ); + assert.throws( + () => { + language.validateLanguageOptions({ + frontmatter: Symbol("frontmatter"), + }); + }, + { + message: + 'Invalid language option value `Symbol(frontmatter)` for frontmatter. Expected one of `false`, `"yaml"`, `"toml"`, or `"json"`.', + }, + ); }); it("should not throw an error when `frontmatter` has a correct value in commonmark mode", () => { @@ -116,6 +127,17 @@ describe("MarkdownLanguage", () => { "Invalid language option value `123` for math. Expected a boolean.", }, ); + assert.throws( + () => { + language.validateLanguageOptions({ + math: Symbol("math"), + }); + }, + { + message: + "Invalid language option value `Symbol(math)` for math. Expected a boolean.", + }, + ); }); it("should not throw an error when `math` has a correct value in commonmark mode", () => {