Skip to content

Commit

Permalink
Merge pull request #65 from SphtKr/issue-60
Browse files Browse the repository at this point in the history
Fixes #60, better log messages when bad un/pw or URL failures.
  • Loading branch information
SphtKr authored Nov 11, 2016
2 parents 9d163e6 + a9f931b commit 7542c75
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,21 @@ ZWayServerPlatform.prototype = {
deferred.reject(response);
}
});
} else if(response && response.statusCode == 401){
that.log("ERROR: Fatal! Authentication failed (error code 401)! Check the username and password in config.json!");
deferred.reject(response);
} else {
that.log("ERROR: Fatal! Authentication failed with unexpected HTTP response code " + response.statusCode + "!");
deferred.reject(response);
}
});
} else if(response && response.statusCode == 200) {
deferred.resolve(body);
} else {
debug("ERROR: Request failed!");
that.log("ERROR: Request failed! "
+ (response ? "HTTP response code " + response.statusCode + ". " : "")
+ (error ? "Error code " + error.code + ". " : "")
+ "Check the URL in config.json and ensure that the URL can be reached from this system!");
if(response) debug(response); else debug(error);
deferred.reject(response);
}
Expand Down

0 comments on commit 7542c75

Please sign in to comment.