Wrap raw file HEAD check in try-catch in case of invalid URL

This commit is contained in:
Calvin Montgomery 2018-07-25 21:38:09 -07:00
parent 3d520ecf57
commit d54707c9c7
1 changed files with 60 additions and 52 deletions

View File

@ -149,6 +149,8 @@ function testUrl(url, cb, params = { redirCount: 0, cookie: '' }) {
if (cookie) {
data.headers = { 'Cookie': cookie };
}
try {
var req = transport.request(data, function (res) {
req.abort();
@ -211,6 +213,12 @@ function testUrl(url, cb, params = { redirCount: 0, cookie: '' }) {
});
req.end();
} catch (error) {
LOGGER.error('Unable to make raw file probe request: %s', error.stack);
cb("An unexpected error occurred while trying to process the link. " +
"Try again, and contact support for further troubleshooting if the " +
"problem continues.");
}
}
function readOldFormat(buf) {