You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by gl...@apache.org on 2022/11/03 09:35:03 UTC

[couchdb-nano] branch main updated: callback javascript errors instead of objects (#303)

This is an automated email from the ASF dual-hosted git repository.

glynnbird pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-nano.git


The following commit(s) were added to refs/heads/main by this push:
     new 62e104d  callback javascript errors instead of objects (#303)
62e104d is described below

commit 62e104d0f9cfdca5a283db00b8ee6c48e43eb181
Author: Pedro Narciso GarcĂ­a Revington <p....@gmail.com>
AuthorDate: Thu Nov 3 10:34:58 2022 +0100

    callback javascript errors instead of objects (#303)
---
 lib/nano.js | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/nano.js b/lib/nano.js
index fd85bc0..04669b8 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -137,11 +137,9 @@ module.exports = exports = function dbScope (cfg) {
         reject(new Error(`error happened in your connection. Reason: ${response.message}`))
       }
       if (callback) {
-        const returnError = {
-          message: `error happened in your connection. Reason: ${response.message}`,
-          scope: 'socket',
-          errid: 'request'
-        }
+        const returnError = new Error(`error happened in your connection. Reason: ${response.message}`)
+        returnError.scope = 'socket'
+        returnError.errid = 'request'
         callback(returnError)
       }
       return