Comparing version 0.6.4 to 0.6.5
@@ -52,3 +52,3 @@ var request = require('request'); | ||
if(r.statusCode === 400) { | ||
return done(new ApiError(body.detail || body, r.statusCode)); | ||
return done(new ApiError(body, r.statusCode)); | ||
} | ||
@@ -445,3 +445,3 @@ done(null, body); | ||
if(r.statusCode === 400) { | ||
return done(new ApiError(body.detail || body, 400)); | ||
return done(new ApiError(body, 400)); | ||
} | ||
@@ -525,3 +525,3 @@ if (r.statusCode.toString().substr(0, 1) !== '2') { return done(new ApiError(body, r.statusCode)); } | ||
if (err) { return done(err); } | ||
if (r.statusCode.toString().substr(0, 1) !== '2') { return done(new ApiError(body.detail || body, r.statusCode)); } | ||
if (r.statusCode.toString().substr(0, 1) !== '2') { return done(new ApiError(body, r.statusCode)); } | ||
done(null, body); | ||
@@ -564,3 +564,3 @@ }); | ||
if(r.statusCode === 400) { | ||
return done(new ApiError(body.detail || body, 400)); | ||
return done(new ApiError(body, 400)); | ||
} | ||
@@ -595,3 +595,5 @@ done(null, body); | ||
if (r.statusCode === 404) { return done(); } | ||
if (r.statusCode.toString().substr(0, 1) !== '2') { return done(new ApiError(body.detail || body, r.statusCode)); } | ||
if (r.statusCode.toString().substr(0, 1) !== '2') { | ||
return done(new ApiError(body, r.statusCode)); | ||
} | ||
@@ -611,3 +613,5 @@ done(null, body); | ||
if (err) { return done(err); } | ||
if (r.statusCode.toString().substr(0, 1) !== '2') { return done(new ApiError(body.detail || body, r.statusCode)); } | ||
if (r.statusCode.toString().substr(0, 1) !== '2') { | ||
return done(new ApiError(body, r.statusCode)); | ||
} | ||
@@ -718,5 +722,5 @@ done(null, body); | ||
} | ||
return done(null, results); | ||
}); | ||
}; |
@@ -107,2 +107,6 @@ var request = require('request'); | ||
// XXX: This is a workaround for node 0.8.x. (erase me when we | ||
// drop support for that version). | ||
// _accessTokenTimer is exposed so clients can do clearTimeout and | ||
// make the process end (as unref is not present in node 0.8.x) | ||
self._accessTokenTimer = timer; | ||
@@ -109,0 +113,0 @@ |
@@ -1,12 +0,18 @@ | ||
function ApiError (message, statusCode) { | ||
function ApiError (body, statusCode) { | ||
var message = body.detail || body.error_description || body; | ||
var code = body.error; | ||
var err = Error.call(this, message); | ||
err.name = 'ApiError'; | ||
err.statusCode = statusCode; | ||
err.code = code; | ||
return err; | ||
} | ||
ApiError.prototype = Object.create(Error.prototype, { | ||
constructor: { value: ApiError } | ||
ApiError.prototype = Object.create(Error.prototype, { | ||
constructor: { value: ApiError } | ||
}); | ||
module.exports = ApiError; |
{ | ||
"name": "auth0", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "Client library for the Auth0 platform", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.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
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
72938
1264