scrub authentication details from the error response
diff --git a/lib/nano.js b/lib/nano.js
index ab97228..0cd0bc4 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -60,6 +60,13 @@
       return db;
     }
   }
+  
+  function scrub(str) {
+    if (str) {
+      str = str.replace(/\/\/(.*)@/,"//XXXXXX:XXXXXX@");
+    }
+    return str;
+  }
 
   function relax(opts, callback) {
     if (typeof opts === 'function') {
@@ -224,6 +231,13 @@
       // fix cloudant issues where they give an erlang stacktrace as js
       delete parsed.stack;
 
+      // scrub credentials
+      req.uri = scrub(req.uri);
+      rh.uri = scrub(rh.uri);
+      if (req.headers.cookie) {
+        req.headers.cookie = "XXXXXXX";
+      }
+
       callback(errs.merge({
         message: 'couch returned ' + rh.statusCode,
         scope: 'couch',