Permalink
Browse files

[refactor minor] `nodejitsu-api` returns integer status codes

  • Loading branch information...
1 parent 0945208 commit 2d9cf58e21ad1d1dee7598ac030ef833db4f5a98 @mmalecki mmalecki committed Jun 28, 2012
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/jitsu.js
  2. +1 −1 lib/jitsu/commands/apps.js
  3. +2 −2 lib/jitsu/commands/databases.js
  4. +1 −1 lib/jitsu/commands/snapshots.js
View
@@ -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);
}
@@ -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);
@@ -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;
@@ -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 {
@@ -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);

0 comments on commit 2d9cf58

Please sign in to comment.