Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor edit to error handling #1

Merged
merged 2 commits into from
Sep 6, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down