guo-yu / btc

a command-line bitcoin price board for geeks
MIT License
388 stars 73 forks source link

Crash when an exchange returns wrong / no data #8

Closed askmike closed 10 years ago

askmike commented 10 years ago
  › mtgox         $ 752.00000 14:57
    bitstamp      $ 746.00 14:57
    futures796   updating...
    btcchina      request fail 14:57
    okcoin        ¥ 4973.0 14:57
    chbtc         ¥ 4950.0 14:57
    fxbtc         ¥ 4979 14:57
    btctrade      ¥ 5015 14:57
    btc100        ¥ 4940.000 14:57

TypeError: Cannot read property 'last' of undefined
    at wash (/usr/local/lib/node_modules/btc/libs/cli.js:50:34)
    at /usr/local/lib/node_modules/btc/libs/cli.js:79:28
    at /usr/local/lib/node_modules/btc/libs/bitcoin.js:59:21
    at /usr/local/lib/node_modules/btc/node_modules/sdk/action.js:12:13
    at res (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/index.js:15:9)
    at Request._callback (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/index.js:54:9)
    at Request.self.callback (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/node_modules/request/request.js:129:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/node_modules/request/request.js:873:14)
    at Request.EventEmitter.emit (events.js:117:20)

I will take a shot at adding error handling when I find some time.

guo-yu commented 10 years ago

if you are using btc 0.0.1 ? please update the module and try again later

askmike commented 10 years ago

Yep I was still using 0.0.1. I've updated it and I think it's fixed now.

askmike commented 10 years ago

I've got the same error in 0.0.2 now:

  › mtgox          updating...
    bitstamp       $ 840.00 10:51
    btce           $ 747.00 10:51
    futures796     $ 876.00 10:51
    btcchina       updating...
    okcoin         updating...
    chbtc          updating...
    fxbtc          updating...
    btctrade       updating...
    btc100         updating...

TypeError: Cannot read property 'last' of undefined
    at List.wash [as _wash] (/usr/local/lib/node_modules/btc/libs/cli.js:35:31)
    at /usr/local/lib/node_modules/btc/libs/cli.js:74:33
    at /usr/local/lib/node_modules/btc/libs/bitcoin.js:34:21
    at /usr/local/lib/node_modules/btc/node_modules/sdk/action.js:12:13
    at res (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/index.js:15:9)
    at Request._callback (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/index.js:54:9)
    at Request.self.callback (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/node_modules/request/request.js:129:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/usr/local/lib/node_modules/btc/node_modules/sdk/node_modules/beer/node_modules/request/request.js:873:14)
    at Request.EventEmitter.emit (events.js:117:20)
guo-yu commented 10 years ago

sorry for that, i've fixed it now. try to update it again.

askmike commented 10 years ago

Awesome, thanks!