balena-register-device
Advanced tools
Comparing version 6.1.1 to 6.1.2-include-full-response-in-error-806f68a82e63efb828abedc3d26dc8e7d90d6e91
@@ -18,3 +18,5 @@ // Generated by CoffeeScript 1.12.7 | ||
*/ | ||
var Promise, randomstring; | ||
var ApiError, Promise, TypedError, randomstring, | ||
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, | ||
hasProp = {}.hasOwnProperty; | ||
@@ -25,3 +27,5 @@ Promise = require('bluebird'); | ||
TypedError = require('typed-error').TypedError; | ||
/** | ||
@@ -118,3 +122,3 @@ * @summary Creates a Balena Register Device instance | ||
if (response.statusCode !== 201) { | ||
throw new Error(response.body); | ||
throw new ApiError(response.body, response); | ||
} | ||
@@ -125,1 +129,16 @@ }).get('body').asCallback(callback); | ||
}; | ||
ApiError = (function(superClass) { | ||
extend(ApiError, superClass); | ||
function ApiError(message, response1) { | ||
if (message == null) { | ||
message = 'Error with API request'; | ||
} | ||
this.response = response1; | ||
ApiError.__super__.constructor.call(this, this.message); | ||
} | ||
return ApiError; | ||
})(TypedError); |
@@ -8,2 +8,7 @@ # Change Log | ||
# v6.1.2 | ||
## (2020-05-19) | ||
* Extend API exception to include full response object [Miguel Casqueira] | ||
# v6.1.1 | ||
@@ -10,0 +15,0 @@ ## (2020-04-27) |
{ | ||
"name": "balena-register-device", | ||
"version": "6.1.1", | ||
"version": "6.1.2-include-full-response-in-error-806f68a82e63efb828abedc3d26dc8e7d90d6e91", | ||
"description": "Balena device registration utilities", | ||
@@ -5,0 +5,0 @@ "main": "build/register.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26932
124
1