Skip to content

Commit

Permalink
[refactor minor] nodejitsu-api returns integer status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Jun 28, 2012
1 parent 0945208 commit 2d9cf58
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/jitsu.js
Expand Up @@ -264,10 +264,10 @@ jitsu.showError = function (command, err, shallow, skip) {
var username,
stack;

if (err.statusCode === '403') {
if (err.statusCode === 403) {
//jitsu.log.error('403 ' + err.result.error);
}
else if (err.statusCode === '503') {
else if (err.statusCode === 503) {
if (err.result && err.result.message) {
jitsu.log.error(err.result.message);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/jitsu/commands/apps.js
Expand Up @@ -286,7 +286,7 @@ apps.list = function (username, callback) {

jitsu.apps.list(username, function (err, apps) {
if (err) {
if (err.statusCode === "403") {
if (err.statusCode === 403) {
jitsu.log.error(jitsu.config.get('username').magenta + ' is not authorized to list applications for user: ' + username.magenta);
}
return callback(err);
Expand Down
4 changes: 2 additions & 2 deletions lib/jitsu/commands/databases.js
Expand Up @@ -79,7 +79,7 @@ databases.create = function (requestedDatabaseType, requestedDatabaseName, callb
//
// TODO: Refactor this error handling
//
if (err && err.statusCode === '409' || err.statusCode === '404') {
if (err && err.statusCode === 409 || err.statusCode === 404) {
jitsu.log.error('Database with name ' + database.name.magenta + ' already exists');
jitsu.log.info('Try again with a new database name');
database.name = null;
Expand Down Expand Up @@ -152,7 +152,7 @@ databases.get = function (databaseName, callback) {

jitsu.databases.get(databaseName, function (err, results) {
if (err) {
if (err.statusCode === '404') {
if (err.statusCode === 404) {
jitsu.log.error('Database does not exist');
}
else {
Expand Down
2 changes: 1 addition & 1 deletion lib/jitsu/commands/snapshots.js
Expand Up @@ -178,7 +178,7 @@ snapshots.activate = function (name, callback) {
//
// Remark: The nodejitsu API should probably be returning a 404 here and not a 400
//
if(err.statusCode === "400") {
if(err.statusCode === 400) {
jitsu.log.error('Application ' + name.magenta + ' not found.');
}
return callback(err);
Expand Down

0 comments on commit 2d9cf58

Please sign in to comment.