Skip to content
This repository has been archived by the owner on Nov 28, 2018. It is now read-only.

Commit

Permalink
Reveal syntax error in parsing .mention-bot file by leaving a comment (
Browse files Browse the repository at this point in the history
…#189)

* Refs #188, Add catch block for syntax error in config file

* Refs #188, Create comment to notify custom config file parsing error

* Refs #188, English improvements of the message
  • Loading branch information
jeffreyleeon authored and vjeux committed Nov 27, 2016
1 parent 848695e commit 58bda60
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ async function work(body) {
headers: {
Accept: 'application/vnd.github.v3.raw+json'
}
}).catch(function(e) {
if (e instanceof SyntaxError && repoConfig.actions.indexOf(data.action) !== -1) {
// Syntax error while reading custom configuration file
var message =
'Unable to parse mention-bot custom configuration file due to a syntax error.\n' +
'Please check the potential root causes below:\n\n' +
'1. Having comments\n' +
'2. Invalid JSON type\n' +
'3. Having extra "," in the last JSON attribute';
createComment(data, message);
}
});

repoConfig = {...repoConfig, ...configRes};
Expand Down

0 comments on commit 58bda60

Please sign in to comment.