Skip to content

Commit

Permalink
update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
anotheri committed May 13, 2015
1 parent 2ff5317 commit b00f050
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Module dependencies.
*/

var async = require('async');
var async = require('async'),
request = require('request'),
cheerio = require('cheerio'),
moment = require('moment'),
Expand Down Expand Up @@ -284,11 +284,11 @@ Connect.prototype.login = function(username, password) {
'theAuxValue' : ""
}
}, function(error, response, body) {
var cookies = response.headers['set-cookie'];
var cookies = response ? response.headers['set-cookie'] : null;
// Handle Errors
if(error || !cookies.length) {
if(error || !(cookies && cookies.length)) {
error = error || new Error('There was a problem with recieving cookies. Please check your username and password.');
this.options.errorCallback( error );
self.options.errorCallback( error );
}
else {
// Set _cookies and run callback
Expand Down

0 comments on commit b00f050

Please sign in to comment.