Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pkgcloud

Package Overview
Dependencies
Maintainers
5
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pkgcloud - npm Package Compare versions

Comparing version 0.8.10 to 0.8.11

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## v0.8.11
* Added more robust error handling for openstack.identity admin methods
## v0.8.10

@@ -2,0 +5,0 @@ * Fixing a bug in rackspace.dns where status call can be an empty response

@@ -17,4 +17,19 @@ /*

util = require('util'),
pkgcloud = require('../../../pkgcloud');
pkgcloud = require('../../../pkgcloud'),
errs = require('errs');
// TODO refactor failCodes, getError into global handlers
var failCodes = {
400: 'Bad Request',
401: 'Unauthorized',
403: 'Resize not allowed',
404: 'Item not found',
405: 'Bad Method',
409: 'Build in progress',
413: 'Over Limit',
415: 'Bad Media Type',
500: 'Fault',
503: 'Service Unavailable'
};
/**

@@ -308,7 +323,7 @@ * exports.createIdentity

request(options, function(err, res, body) {
return err
? callback(err)
: (res.statusCode === 200
? callback(err, true, body)
: callback(err, false));
var error = getError(err, res, body);
return error
? callback(error)
: callback(error, body);
});

@@ -366,9 +381,39 @@ }

request(options, function(err, res, body) {
return err
? callback(err)
: (res.statusCode === 200
? callback(err, body)
: callback(err));
return callback(getError(err, res, body));
});
}
};
function getError(err, res, body) {
if (err) {
return err;
}
var statusCode = res.statusCode.toString(),
err2;
if (Object.keys(failCodes).indexOf(statusCode) !== -1) {
//
// TODO: Support more than JSON errors here
//
err2 = {
failCode: failCodes[statusCode],
statusCode: res.statusCode,
message: 'Error (' +
statusCode + '): ' + failCodes[statusCode],
href: res.request.uri.href,
method: res.request.method,
headers: res.headers
};
try {
err2.result = typeof body === 'string' ? JSON.parse(body) : body;
} catch (e) {
err2.result = { err: body };
}
return err2;
}
return;
}

2

package.json
{
"name": "pkgcloud",
"description": "An infrastructure-as-a-service agnostic cloud library for node.js",
"version": "0.8.10",
"version": "0.8.11",
"author": "Nodejitsu Inc <info@nodejitsu.com>",

@@ -6,0 +6,0 @@ "contributors": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc