Skip to content

Loading…

TypeError: Cannot call method 'open' of null #57

Closed
fengmk2 opened this Issue · 3 comments

2 participants

@fengmk2
KISS JS team. member

模拟网络不通的时候,捕获到一下错误:

/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/db.js:99
      this.db.open(function (err, db) {
              ^
TypeError: Cannot call method 'open' of null
    at [object Object].open (/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/db.js:99:15)
    at [object Object].open (/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/collection.js:111:19)
    at [object Object]._find (/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/utils.js:64:10)
    at [object Object].find (/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/collection.js:292:16)
    at [object Object].findItems (/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/collection.js:191:13)
    at Object.getAll (/Users/mk2/svn/xx/proxy/field.js:100:13)
    at syncFields (/Users/mk2/svn/xx/proxy/field.js:119:11)
    at /Users/mk2/svn/xx/proxy/field.js:158:14
    at Object.error (/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/utils.js:27:5)
    at EventEmitter.<anonymous> (/Users/mk2/svn/xx/node_modules/mongoskin/lib/mongoskin/utils.js:66:17)
@fengmk2 fengmk2 was assigned
@guileen
KISS JS team. member

How to reproduce this ?

@fengmk2
KISS JS team. member
@guileen guileen added a commit that referenced this issue
@guileen guileen update #57 c8acb90
@guileen
KISS JS team. member

修改後,第一次獲得正常的錯誤:

2012-7-4 11:22:7 [integration/longlive.js:10]:[Error: failed to connect to [192.168.0.103:27017]]

但第二次嘗試打開時拋出錯誤:

[ERROR] Error
Error: db object already connecting, open cannot be called multiple times
at Db.open (/Users/gl/workspace/node-mongoskin/node_modules/mongodb/lib/mongodb/db.js:234:11)
at [object Object].open (/Users/gl/workspace/node-mongoskin/lib/mongoskin/db.js:101:20)
at [object Object].open (/Users/gl/workspace/node-mongoskin/lib/mongoskin/collection.js:111:19)
at [object Object].insert (/Users/gl/workspace/node-mongoskin/lib/mongoskin/utils.js:64:10)
at Timer. (/Users/gl/workspace/node-mongoskin/integration/longlive.js:9:9)
at Timer.ontimeout (timers.js:223:14)

@guileen guileen added a commit that referenced this issue
@guileen guileen add a longlive example for test #57 c379ba2
@fengmk2 fengmk2 added a commit that referenced this issue
@fengmk2 fengmk2 add test case to reproduce #57 4d8e142
@fengmk2 fengmk2 closed this in f73a561
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.