Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

Paul Gebheim Gui Lin
Paul Gebheim

On connect error I'm getting a slew of 'undefined is not a function' because no check is being done. Print an error message instead of there's no callback.

Gui Lin guileen merged commit 851281c into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2012
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/mongoskin/collection.js
7 lib/mongoskin/collection.js
View
@@ -69,7 +69,12 @@ var bindSkin = function(name, method) {
var args = arguments.length > 0 ? __slice.call(arguments, 0) : [];
this.open(function(err, collection) {
if (err) {
- args[args.length - 1](err);
+ var cb = args.pop();
+ if(cb) {
+ cb(err)
+ } else {
+ console.error("Error occured with no callback to handle it while calling SkinCollection." + name, err);
+ }
} else {
method.apply(collection, args);
}
Something went wrong with that request. Please try again.