Jack-Flux / node-opskins-trade

JavaScript SDK for Trade.OPSkins' HTTP API
https://trade.OPSkins.com
2 stars 3 forks source link

Unexpected crash #11

Closed austinnguyen01 closed 6 years ago

austinnguyen01 commented 6 years ago

SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse () at Request.request.get [as _callback] (C:\coding\htdocs\bot\libs\helpers\request.js:28:44) at self.callback (C:\coding\htdocs\bot\node_modules\request\request.js:185:22) at emitOne (events.js:116:13) at Request.emit (events.js:211:7) at Request.onRequestError (C:\coding\htdocs\bot\node_modules\request\request.js:877:8) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7) at TLSSocket.socketErrorListener (_http_client.js:387:9) at emitOne (events.js:116:13)

The bot crashes randomly with this sometimes anyone have a fix?

creazy231 commented 6 years ago

The "u" comes from the return of "undefined" I simply made an "if" statement to prevent the bot from crashing. I will send you the snippet when Im back at home later today :)

Jack-Flux commented 6 years ago

It's due to a response from the VGO api, like @creazy231 stated just check the response is okay to prevent the crash.