From 3d54de851f51939e8cf02f458c24d3f566306b4d Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Sat, 19 Apr 2014 19:30:44 -0400 Subject: [PATCH] handle errors from localtunnel server when requesting initial url --- client.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.js b/client.js index bd10271..7d0d567 100644 --- a/client.js +++ b/client.js @@ -199,6 +199,11 @@ Tunnel.prototype._init = function(cb) { return setTimeout(get_url, 1000); } + if (res.status !== 200) { + var err = new Error((body && body.message) || 'localtunnel server returned an error, please try again'); + return cb(err); + } + var port = body.port; var host = upstream.hostname;