Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Updated error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
RazzM13 committed Apr 3, 2018
1 parent 045ddf3 commit 1ed832d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,18 @@ if(firstArg == "validate"){
try {
result = validator.validateFile(secondArg, options);
} catch(err) {
console.log('Unable to parse template!');
let error: string = function(msg: string, errors: any) {
for (let error of Object.keys(errors)) {
if (RegExp(error).test(msg)) {
return errors[error];
}
}
return errors[''];
}(err.message, {
'Could not find file .*. Check the input path.': 'No such file.',
'': 'Unable to parse template! Use --verbose for more information.'
});
console.log(error);
if (program.verbose) {
console.error(err);
}
Expand Down

0 comments on commit 1ed832d

Please sign in to comment.