mirror of https://github.com/calzoneman/sync.git
Add try-catch to urlRetrieve to prevent uncaught HTTPS exceptions
This commit is contained in:
parent
dba93ca3b6
commit
9c22fbc462
24
get-info.js
24
get-info.js
|
@ -17,18 +17,22 @@ var CustomEmbedFilter = require("./customembed").filter;
|
|||
|
||||
module.exports = function (Server) {
|
||||
function urlRetrieve(transport, options, callback) {
|
||||
var req = transport.request(options, function (res) {
|
||||
var buffer = "";
|
||||
res.setEncoding("utf-8");
|
||||
res.on("data", function (chunk) {
|
||||
buffer += chunk;
|
||||
try {
|
||||
var req = transport.request(options, function (res) {
|
||||
var buffer = "";
|
||||
res.setEncoding("utf-8");
|
||||
res.on("data", function (chunk) {
|
||||
buffer += chunk;
|
||||
});
|
||||
res.on("end", function () {
|
||||
callback(res.statusCode, buffer);
|
||||
});
|
||||
});
|
||||
res.on("end", function () {
|
||||
callback(res.statusCode, buffer);
|
||||
});
|
||||
});
|
||||
|
||||
req.end();
|
||||
req.end();
|
||||
} catch(e) {
|
||||
callback(503, "");
|
||||
}
|
||||
}
|
||||
|
||||
var Getters = {
|
||||
|
|
Loading…
Reference in New Issue