eh-api-client
Advanced tools
Comparing version 0.42.0 to 0.42.1
@@ -23,4 +23,5 @@ var | ||
function buildError(res, data) { | ||
function buildError(res, data, callerStack) { | ||
var error = new Error(); | ||
error.callerStack = callerStack | ||
Error.captureStackTrace(error, buildError) | ||
@@ -40,3 +41,3 @@ error.stack = '(' + res.request.method + ' ' + res.request.uri.href + ') ' + error.stack | ||
function buildNetworkError(origErr) { | ||
function buildNetworkError(origErr, callerStack) { | ||
var error = new NetworkError(origErr.code, origErr.requestParams); | ||
@@ -46,3 +47,4 @@ error.retryInfo = origErr.retryInfo; | ||
error.origErr = origErr | ||
return error; | ||
error.callerStack = callerStack | ||
return error | ||
} | ||
@@ -136,2 +138,4 @@ | ||
Client.prototype.request = function(method, options, body, cb) { | ||
const callerStack = new Error().stack | ||
if(typeof body === "function") { | ||
@@ -238,3 +242,3 @@ cb = body; | ||
}) | ||
return reject(buildNetworkError(err)); | ||
return reject(buildNetworkError(err, callerStack)); | ||
} | ||
@@ -248,3 +252,3 @@ emitRequestDone(res) | ||
else { | ||
return reject(buildError(res, data)); | ||
return reject(buildError(res, data, callerStack)); | ||
} | ||
@@ -251,0 +255,0 @@ } |
{ | ||
"name": "eh-api-client", | ||
"version": "0.42.0", | ||
"version": "0.42.1", | ||
"description": "Node.js rest client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,3 +48,3 @@ var | ||
err.name.should.equal("ServerError"); | ||
err.stack.indexOf('http://localhost:' + SERVER_PORT + '/').should.equal(1) | ||
err.stack.indexOf('http://localhost:' + SERVER_PORT + '/').should.equal(5) | ||
res.statusCode.should.equal(503); | ||
@@ -86,3 +86,3 @@ done(); | ||
client.get("/", function(err) { | ||
err.stack.indexOf('http://localhost:' + SERVER_PORT + '/').should.equal(1) | ||
err.stack.indexOf('http://localhost:' + SERVER_PORT + '/').should.equal(5) | ||
err.name.should.equal("NetworkError"); | ||
@@ -89,0 +89,0 @@ err.message.should.equal("ESOCKETTIMEDOUT"); |
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
85269
2077