Skip to content

Commit 0fd1579

Browse files
authored
Merge pull request #185 from xbow-engineering/catch-http.request-exception
Fix missing callback in buildRequest.
2 parents 776f271 + aee7e4e commit 0fd1579

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/modem.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,13 @@ Modem.prototype.buildRequest = function (options, context, data, callback) {
273273
protocol: 'http:',
274274
}) : options;
275275

276-
var req = http[self.protocol === 'ssh' ? 'http' : self.protocol].request(opts, function () { });
276+
var req = null;
277+
try {
278+
req = http[self.protocol === 'ssh' ? 'http' : self.protocol].request(opts, function () { });
279+
} catch (e) {
280+
callback(e);
281+
return;
282+
}
277283

278284
debug('Sending: %s', util.inspect(options, {
279285
showHidden: true,

0 commit comments

Comments
 (0)