use callback not throw

This commit is contained in:
AJ ONeal 2018-06-26 14:43:56 -06:00
parent 28e67055e7
commit 94eec37646
1 changed files with 2 additions and 1 deletions

View File

@ -186,7 +186,8 @@ function setDefaults(defs) {
debug(finalOpts); debug(finalOpts);
req = http.request(finalOpts, onResponse); req = http.request(finalOpts, onResponse);
} else { } else {
throw new Error("unknown protocol: '" + opts.uri.protocol + "'"); cb(new Error("unknown protocol: '" + opts.uri.protocol + "'"));
return;
} }
req.on('error', function (e) { req.on('error', function (e) {