Skip to content

Commit

Permalink
Chore: Error => TypeError (#9390)
Browse files Browse the repository at this point in the history
* Chore: Error => TypeError

* Chore: parse error => SyntaxError.
  • Loading branch information
aladdin-add authored and not-an-aardvark committed Oct 6, 2017
1 parent ee99876 commit c581b77
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/ignored-paths.js
Expand Up @@ -184,7 +184,7 @@ class IgnoredPaths {
addPattern(this.ig.default, pattern);
});
} else {
throw new Error("Package.json eslintIgnore property requires an array of paths");
throw new TypeError("Package.json eslintIgnore property requires an array of paths");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/testers/rule-tester.js
Expand Up @@ -178,7 +178,7 @@ class RuleTester {
*/
static setDefaultConfig(config) {
if (typeof config !== "object") {
throw new Error("RuleTester.setDefaultConfig: config must be an object");
throw new TypeError("RuleTester.setDefaultConfig: config must be an object");
}
defaultConfig = config;

Expand Down Expand Up @@ -254,7 +254,7 @@ class RuleTester {
linter = this.linter;

if (lodash.isNil(test) || typeof test !== "object") {
throw new Error(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`);
throw new TypeError(`Test Scenarios for rule ${ruleName} : Could not find test scenario object`);
}

requiredScenarios.forEach(scenarioType => {
Expand Down
2 changes: 1 addition & 1 deletion lib/util/node-event-generator.js
Expand Up @@ -160,7 +160,7 @@ function tryParseSelector(rawSelector) {
return esquery.parse(rawSelector.replace(/:exit$/, ""));
} catch (err) {
if (typeof err.offset === "number") {
throw new Error(`Syntax error in selector "${rawSelector}" at position ${err.offset}: ${err.message}`);
throw new SyntaxError(`Syntax error in selector "${rawSelector}" at position ${err.offset}: ${err.message}`);
}
throw err;
}
Expand Down

0 comments on commit c581b77

Please sign in to comment.