Skip to content

Commit

Permalink
Merge pull request #61 from alexfernandez/master
Browse files Browse the repository at this point in the history
Improved error when adding project without admin rights.
  • Loading branch information
Ilya Radchenko committed Jan 25, 2016
2 parents 5362eb0 + a93098f commit 2bb1b10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
10 changes: 8 additions & 2 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2bb1b10

Please sign in to comment.