dparlevliet / node.bittrex.api

Node Bittrex API is an asynchronous node.js library for the Bittrex API, the data can be received either via GET request or Stream.
MIT License
253 stars 100 forks source link

Uncaught exception Error 504 #135

Open maintwitter7 opened 6 years ago

maintwitter7 commented 6 years ago

Sometimes when Bittrex is under high load, the server returns a 504 which immediately causes the application to crash. Is there a way to catch the error in the callback instead of throwing it?

uncaughtException: unexpected server response (504)
"date":"Sun Jan 21 2018 21:22:34 GMT+0000 (UTC)"
"process": {
    "pid": 4,
    "uid": 54377,
    "gid": 54377,
    "cwd": "/app",
    "execPath": "/app/.heroku/node/bin/node",
    "version": "v8.9.4",
    "argv": [
        "/app/.heroku/node/bin/node",
        "/app/index.js"
    ],
    "memoryUsage": {
        "rss": 179290112,
        "heapTotal": 113143808,
        "heapUsed": 38858856,
        "external": 18481412
    }
}
{
    "os": {
        "loadavg": [
            2.96826171875,
            2.36474609375,
            3.35595703125
        ],
        "uptime": 1367647
    },
    "trace": [
        {
            "column": 21,
            "file": "/app/node_modules/ws/lib/WebSocket.js",
            "function": "ClientRequest._req.on",
            "line": 653,
            "method": "on",
            "native": false
        }
    ]
}
{
    "column": 13,
    "file": "events.js",
    "function": "emitOne",
    "line": 116,
    "method": null,
    "native": false
}
{
    "column": 7,
    "file": "events.js",
    "function": "ClientRequest.emit",
    "line": 211,
    "method": "emit",
    "native": false
}
{
    "column": 21,
    "file": "_http_client.js",
    "function": "HTTPParser.parserOnIncomingClient [as onIncoming]",
    "line": 551,
    "method": "parserOnIncomingClient [as onIncoming]",
    "native": false
}