Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes StackTrace for #93

  • Loading branch information...
commit 28e5259b9e9ba737a1ae2d5c507742e3359346a5 1 parent 6502b93
@dscape authored
View
3  nano.js
@@ -287,6 +287,9 @@ module.exports = exports = nano = function database_module(cfg) {
else { // proxy the error directly from couchdb
log({err: 'couch', body: parsed, headers: rh});
if (!parsed) { parsed = {}; }
+ if (!parsed.message && (parsed.reason || parsed.error)) {
+ parsed.message = (parsed.reason || parsed.error);
+ }
errs.handle(errs.merge(errs.create(parsed),
{ "scope" : "couch"
, "status_code" : status_code
View
1  package.json
@@ -24,6 +24,7 @@
, "John Lancaster <john.k.lancaster@gmail.com> (http://jlank.com)"
, "Clemens Stolle (https://github.com/klaemo)"
, "Jay Beavers <jay.beavers@microsoft.com> (http://jaybeavers.org)"
+ , "Juraj Vitko"
]
, "keywords" :
["couchdb", "data", "request", "json", "nosql", "micro", "nano", "database"]
View
5 tests/fixtures/shared/error.json
@@ -20,6 +20,11 @@
, "response" : "{\"ok\": true, \"version\": \"1.1.0\"}"
}
, { "method" : "delete"
+ , "path" : "/say_wat_wat"
+ , "status" : 404
+ , "response" : "{\"error\":\"not_found\",\"reason\":\"missing\"}"
+ }
+, { "method" : "delete"
, "path" : "/shared_error"
, "response" : "{ \"ok\": true }"
}
View
8 tests/shared/error.js
@@ -78,6 +78,14 @@ specify("shared_error:callback", timeout, function (assert) {
});
});
+specify("shared_error:bad_delete", timeout, function (assert) {
+ nano.db.destroy("say_wat_wat", function (error, response) {
+ assert.ok(error, "There must be an error");
+ assert.ok(error.message, "A note is given");
+ assert.equal(error.description,'missing');
+ });
+});
+
specify("shared_error:teardown", timeout, function (assert) {
nano.db.destroy("shared_error", function (err) {
assert.equal(err, undefined, "Failed to destroy database");
Please sign in to comment.
Something went wrong with that request. Please try again.