Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Check whether there's a callback to handle the open error

  • Loading branch information...
commit fadc4349f834dec652794bd6f1ae2e3074e77c98 1 parent dff7499
Paul Gebheim authored March 16, 2012

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  lib/mongoskin/collection.js
7  lib/mongoskin/collection.js
@@ -69,7 +69,12 @@ var bindSkin = function(name, method) {
69 69
     var args = arguments.length > 0 ? __slice.call(arguments, 0) : [];
70 70
     this.open(function(err, collection) {
71 71
       if (err) {
72  
-        args[args.length - 1](err);
  72
+        var cb = args.pop();
  73
+        if(cb) {
  74
+          cb(err)
  75
+        } else {
  76
+          console.error("Error occured with no callback to handle it while calling SkinCollection." + name,  err);
  77
+        }
73 78
       } else {
74 79
         method.apply(collection, args);
75 80
       }

0 notes on commit fadc434

Please sign in to comment.
Something went wrong with that request. Please try again.