mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-21 08:20:12 +01:00
Refactor custom rule exception tests for smaller size and better coverage.
This commit is contained in:
parent
e7662b11b5
commit
109e0d8cb6
3 changed files with 129 additions and 179 deletions
|
|
@ -1446,9 +1446,10 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul
|
|||
rule.function(params, onError);
|
||||
}
|
||||
catch (error) {
|
||||
var message = (error instanceof Error) ? error.message : error;
|
||||
onError({
|
||||
"lineNumber": 1,
|
||||
"detail": "This rule threw an exception: " + error.message
|
||||
"detail": "This rule threw an exception: " + message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1462,7 +1463,7 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul
|
|||
}
|
||||
catch (error) {
|
||||
cache.clear();
|
||||
return callback(error);
|
||||
return callback((error instanceof Error) ? error : new Error(error));
|
||||
}
|
||||
cache.clear();
|
||||
// Sort results by rule name by line number
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue