Skip to content

Commit 2bb1b10

Browse files
author
Ilya Radchenko
committed
Merge pull request #61 from alexfernandez/master
Improved error when adding project without admin rights.
2 parents 5362eb0 + a93098f commit 2bb1b10

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,5 @@ of the following are set. On GitHub Enterprise, log in to the profile you are tr
6060

6161
- Make sure your github profile has a public email set
6262
* Go to https://github.com/settings/profile and select an email under "Public email".
63+
- Make sure you have admin rights on the projects before adding them,
64+
since strider will need to create webhooks for the integration to work.

lib/api.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@ function createHooks(reponame, url, secret, token, callback) {
5050
.end(function (err, res) {
5151
if (err) return callback(err);
5252

53-
if (res.statusCode !== 201) {
54-
var badStatusErr = new Error('Bad status code: ' + res.statusCode);
53+
var badStatusErr;
54+
if (res.statusCode === 404) {
55+
badStatusErr = new Error('Cannot create webhooks; are you sure you have admin rights?');
56+
badStatusErr.statusCode = res.statusCode;
57+
return callback(badStatusErr);
58+
}
59+
else if (res.statusCode !== 201) {
60+
badStatusErr = new Error('Bad status code: ' + res.statusCode);
5561
badStatusErr.statusCode = res.statusCode;
5662
return callback(badStatusErr);
5763
}

0 commit comments

Comments
 (0)