Comparing version 4.0.0-alpha2 to 4.0.0-alpha3
@@ -16,2 +16,6 @@ 'use strict'; | ||
var _httpErrors = require('http-errors'); | ||
var _httpErrors2 = _interopRequireDefault(_httpErrors); | ||
var _extend = require('extend'); | ||
@@ -126,11 +130,17 @@ | ||
}, function (err, res) { | ||
if (err) callback(err);else if (res.headers['content-type'].match(MIME_JSON)) { | ||
try { | ||
res.rawBody = res.body; | ||
res.body = JSON.parse(res.rawBody); | ||
} catch (e) { | ||
return callback((0, _extend2['default'])(e, { response: res })); | ||
if (err) callback(err);else { | ||
res.rawBody = res.body; | ||
if (res.headers['content-type'].match(MIME_JSON)) { | ||
try { | ||
res.body = JSON.parse(res.rawBody); | ||
} catch (e) { | ||
return callback((0, _extend2['default'])(e, { response: res })); | ||
} | ||
} | ||
if (!res.body.error) callback(null, res);else callback((0, _extend2['default'])(new _error2['default'](res.body), { response: res })); | ||
} else callback(null, (0, _extend2['default'])(res, { rawBody: res.body })); | ||
if (res.body && res.body.error && res.body.hasOwnProperty('code') && res.body.hasOwnProperty('errorMessage') && res.body.hasOwnProperty('errorNum')) { | ||
callback((0, _extend2['default'])(new _error2['default'](res.body), { response: res })); | ||
} else if (res.statusCode >= 400) { | ||
callback((0, _extend2['default'])((0, _httpErrors2['default'])(res.statusCode), { response: res })); | ||
} else callback(null, res); | ||
} | ||
}); | ||
@@ -137,0 +147,0 @@ return promise; |
{ | ||
"name": "arangojs", | ||
"version": "4.0.0-alpha2", | ||
"version": "4.0.0-alpha3", | ||
"description": "The official ArangoDB JavaScript driver.", | ||
@@ -67,4 +67,5 @@ "main": "lib/index.js", | ||
"extend": "^3.0.0", | ||
"http-errors": "^1.3.1", | ||
"linkedlist": "^1.0.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
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
Network access
Supply chain riskThis module accesses the network.
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
178449
1988
3
3
+ Addedhttp-errors@^1.3.1
+ Addeddepd@1.1.2(transitive)
+ Addedhttp-errors@1.8.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedsetprototypeof@1.2.0(transitive)
+ Addedstatuses@1.5.0(transitive)
+ Addedtoidentifier@1.0.1(transitive)