Permalink
Browse files

Catch 404 errors on non-existant travis builds

  • Loading branch information...
1 parent 077fd61 commit 08e65e90c6c7f63a25c58459d6d3ea1086b775b7 @davglass davglass committed Oct 12, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/cmds/travis.js
View
@@ -43,13 +43,26 @@ mods = {
url: 'https://travis-ci.org/' + user + '/' + repo + '.json',
json: true
}, function(err, res) {
+ if (res.statusCode !== 200) {
+ console.log(' ', log.bad, 'failed to fetch info for', user + '/' + repo);
+ if (callback) {
+ callback();
+ }
+ return;
+ }
var last = res.body.last_build_status;
console.log(' ', ((last) ? log.bad : ((last === null) ? log.progress : log.good)), res.body.slug);
request({
url: 'https://travis-ci.org/' + user + '/' + repo + '/builds/' + res.body.last_build_id + '.json',
json: true
}, function(err, body) {
-
+ if (body.statusCode !== 200) {
+ console.log(' ', log.bad, 'failed to fetch info for', user + '/' + repo);
+ if (callback) {
+ callback();
+ }
+ return;
+ }
var json = body.body,
message = json.message.split('\n')[0],
sha = json.commit.substring(0, 7);

0 comments on commit 08e65e9

Please sign in to comment.