mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-01 13:38:49 +01: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
|
|
@ -1717,13 +1717,14 @@ function parseConfiguration(name, content, parsers) {
|
|||
var config = null;
|
||||
var message = "";
|
||||
var errors = [];
|
||||
var index = 0;
|
||||
// Try each parser
|
||||
(parsers || [JSON.parse]).every(function (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