Comparing version 1.8.0 to 1.9.0
@@ -7,30 +7,38 @@ /** | ||
var inherits = require('util').inherits; | ||
var | ||
inherits = require('util').inherits, | ||
_ = require('lodash'); | ||
exports.EbayClientError = function EbayClientError(message) { | ||
function EbayClientError(message, extraProps) { | ||
Error.apply(this, arguments); | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = this.constructor.name; | ||
this.message = message; | ||
}; | ||
inherits(exports.EbayClientError, Error); | ||
_.extend(this, {message: message}, extraProps); | ||
} | ||
inherits(EbayClientError, Error); | ||
exports.EbaySystemError = function EbaySystemError(message) { | ||
Error.captureStackTrace(this, this.constructor); | ||
function EbaySystemError(message, extraProps) { | ||
EbayClientError.apply(this, arguments); | ||
this.name = this.constructor.name; | ||
this.message = message; | ||
}; | ||
inherits(exports.EbaySystemError, Error); | ||
} | ||
inherits(EbaySystemError, EbayClientError); | ||
exports.EbayRequestError = function EbayRequestError(message) { | ||
Error.captureStackTrace(this, this.constructor); | ||
function EbayRequestError(message) { | ||
EbayClientError.apply(this, arguments); | ||
this.name = this.constructor.name; | ||
this.message = message; | ||
}; | ||
inherits(exports.EbayRequestError, Error); | ||
} | ||
inherits(EbayRequestError, EbayClientError); | ||
exports.EbayAuthenticationError = function EbayAuthenticationError(message) { | ||
Error.captureStackTrace(this, this.constructor); | ||
function EbayAuthenticationError(message) { | ||
EbayClientError.apply(this, arguments); | ||
this.name = this.constructor.name; | ||
this.message = message; | ||
} | ||
inherits(EbayAuthenticationError, EbayClientError); | ||
module.exports = { | ||
EbayClientError: EbayClientError, | ||
EbaySystemError: EbaySystemError, | ||
EbayRequestError: EbayRequestError, | ||
EbayAuthenticationError: EbayAuthenticationError, | ||
}; | ||
inherits(exports.EbayAuthenticationError, Error); |
@@ -260,2 +260,3 @@ /** | ||
errors, // error object(s) in response. | ||
extraErrorProps, | ||
error = null; // final Error instance | ||
@@ -313,18 +314,18 @@ | ||
// more context for programatically interpreting the error | ||
extraErrorProps = { | ||
severityCode: errorSeverityCode, | ||
classification: errorClassification, | ||
errors: errors, | ||
details: _.clone(ack), | ||
requestContext: _.clone(requestContext) | ||
}; | ||
// still pass back the data! so client can ignore the warning/error if it chooses. | ||
if (errorClassification === 'SystemError') { | ||
error = new EbaySystemError("eBay API system " + errorSeverityCode.toLowerCase() + ": " + errorMessage); | ||
error = new EbaySystemError("eBay API system " + errorSeverityCode.toLowerCase() + ": " + errorMessage, extraErrorProps); | ||
} | ||
else { | ||
error = new EbayRequestError("eBay API request " + errorSeverityCode.toLowerCase() + ": " + errorMessage); | ||
error = new EbayRequestError("eBay API request " + errorSeverityCode.toLowerCase() + ": " + errorMessage, extraErrorProps); | ||
} | ||
// more context for programatically interpreting the error | ||
if (error) { | ||
error.severityCode = errorSeverityCode; | ||
error.classification = errorClassification; | ||
error.errors = errors; | ||
error.details = _.clone(ack); | ||
error.requestContext = _.clone(requestContext); | ||
} | ||
} | ||
@@ -331,0 +332,0 @@ |
{ | ||
"name": "ebay-api", | ||
"description": "eBay API Client", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"homepage": "https://github.com/benbuckman/nodejs-ebay-api", | ||
@@ -6,0 +6,0 @@ "author": "Ben Buckman", |
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
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
98659
32
1672