mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add information about parser/index to error messages when parsing configuration file content.
This commit is contained in:
parent
925f9cd168
commit
7330ea4946
3 changed files with 10 additions and 6 deletions
|
@ -896,12 +896,13 @@ function parseConfiguration(name, content, parsers) {
|
|||
let config = null;
|
||||
let message = "";
|
||||
const errors = [];
|
||||
let index = 0;
|
||||
// Try each parser
|
||||
(parsers || [ JSON.parse ]).every((parser) => {
|
||||
try {
|
||||
config = parser(content);
|
||||
} catch (error) {
|
||||
errors.push(error.message);
|
||||
errors.push(`Parser ${index++}: ${error.message}`);
|
||||
}
|
||||
return !config;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue