Skip to content

Commit

Permalink
Merge pull request #115 from alexjoverm/feat/checker-better-message
Browse files Browse the repository at this point in the history
feat(checker): better conflict-rules message
  • Loading branch information
alexjoverm authored Mar 12, 2018
2 parents 6d132a9 + b4e99af commit ce4c09e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion bin/check.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
#!/usr/bin/env node
require('../lib/checker').check(process.argv[2]);

try {
require("../lib/checker").check(process.argv[2]);
} catch (e) {
if (e.name === "ConflictRules") {
console.log(e.message);
process.exitCode = 1;
} else {
throw e;
}
}
4 changes: 3 additions & 1 deletion tools/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const check = (configFilePath: string) => {
});

if (conflictRules.length !== 0) {
throw new Error(`Conflict rule(s) detected in ${configFilePath}:\n${conflictRules.join("\n")}`);
const error = new Error(`Conflict rule(s) detected in ${configFilePath}:\n${conflictRules.join("\n")}`);
error.name = "ConflictRules";
throw error;
}

// tslint:disable-next-line:no-console
Expand Down

0 comments on commit ce4c09e

Please sign in to comment.