Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Error handling on request should now work properly.

  • Loading branch information...
commit ce891e61a3dec11cabc9371d645957774ec45887 1 parent f7093e6
@existentialism existentialism authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/main.js
View
18 lib/main.js
@@ -66,7 +66,7 @@ var init = exports.init = function(host) {
Return a list of object literals containing the name and color of all jobs on the Jenkins server
*/
request({method: 'GET', url: build_url(LIST)}, function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
@@ -79,7 +79,7 @@ var init = exports.init = function(host) {
Get all information for a job
*/
request({method: 'GET', url: build_url(JOBINFO, jobname)}, function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
@@ -92,7 +92,7 @@ var init = exports.init = function(host) {
Get information for the last build of a job
*/
request({method: 'GET', url: build_url(LAST_BUILD, jobname)}, function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
@@ -105,7 +105,7 @@ var init = exports.init = function(host) {
Get the last build report for a job
*/
request({method: 'GET', url: build_url(LAST_REPORT, jobname)}, function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
@@ -118,7 +118,7 @@ var init = exports.init = function(host) {
Get the config xml for a job
*/
request({method: 'GET', url: build_url(CONFIG, jobname)}, function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
@@ -140,7 +140,7 @@ var init = exports.init = function(host) {
},
function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
@@ -176,7 +176,7 @@ var init = exports.init = function(host) {
Deletes a job
*/
request({method: 'POST', url: build_url(DELETE, jobname)}, function(error, response, body) {
- if (response.statusCode == 404 || error){
+ if ( error || response.statusCode === 404 ) {
callback(error || true, response);
return;
}
@@ -189,7 +189,7 @@ var init = exports.init = function(host) {
Get the last build report for a job
*/
request({method: 'POST', url: build_url(LAST_SUCCESS, jobname)}, function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
@@ -207,7 +207,7 @@ var init = exports.init = function(host) {
last_result_url = data['lastBuild']['url'];
request({method: 'GET', url: build_url(last_result_url + API, jobname)}, function(error, response, body) {
- if (response.statusCode != 200 || error){
+ if ( error || response.statusCode !== 200 ) {
callback(error || true, response);
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.