diff --git a/lib/index.js b/lib/index.js index b5ccf122..46f76783 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1703,7 +1703,7 @@ function getGateway(client, token) { return APIRequest('get', Endpoints.GATEWAY, function (err, res) { if (err || !goodResponse(res)) { client._connecting = false; - return client.emit("disconnect", "Error GETing gateway:\n" + stringifyError(res), 0); + return client.emit("disconnect", "Error GETing gateway:\n" + stringifyError(res), res ? res.statusCode : 0); } return startConnection(client, (res.body.url + "/?encoding=json&v=" + GATEWAY_VERSION)); });