diff --git a/README.md b/README.md index 186ba74..5c85bef 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,5 @@ of the following are set. On GitHub Enterprise, log in to the profile you are tr - Make sure your github profile has a public email set * Go to https://github.com/settings/profile and select an email under "Public email". +- Make sure you have admin rights on the projects before adding them, +since strider will need to create webhooks for the integration to work. diff --git a/lib/api.js b/lib/api.js index 6a99f68..03a1843 100644 --- a/lib/api.js +++ b/lib/api.js @@ -50,8 +50,14 @@ function createHooks(reponame, url, secret, token, callback) { .end(function (err, res) { if (err) return callback(err); - if (res.statusCode !== 201) { - var badStatusErr = new Error('Bad status code: ' + res.statusCode); + var badStatusErr; + if (res.statusCode === 404) { + badStatusErr = new Error('Cannot create webhooks; are you sure you have admin rights?'); + badStatusErr.statusCode = res.statusCode; + return callback(badStatusErr); + } + else if (res.statusCode !== 201) { + badStatusErr = new Error('Bad status code: ' + res.statusCode); badStatusErr.statusCode = res.statusCode; return callback(badStatusErr); }