mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +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
|
|
@ -576,9 +576,10 @@ function lintContent(
|
|||
try {
|
||||
rule.function(params, onError);
|
||||
} catch (error) {
|
||||
const 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}`
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
@ -590,7 +591,7 @@ function lintContent(
|
|||
ruleList.forEach(forRule);
|
||||
} 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