Gracefully handle HTTP errors in ffprobe
This commit is contained in:
parent
f94c8bc8f1
commit
cd0cc69fd8
|
@ -151,12 +151,19 @@ exports.query = function (filename, cb) {
|
||||||
|
|
||||||
exports.ffprobe(filename, function (err, data) {
|
exports.ffprobe(filename, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err.message && err.message.match(/protocol not found/i)) {
|
if (err.code && err.code === "ENOENT") {
|
||||||
return cb("Link uses a protocol unsupported by this server's ffmpeg");
|
|
||||||
} else if (err.code && err.code === "ENOENT") {
|
|
||||||
return cb("Failed to execute `ffprobe`. Set ffmpeg.ffprobe-exec to " +
|
return cb("Failed to execute `ffprobe`. Set ffmpeg.ffprobe-exec to " +
|
||||||
"the correct name of the executable in config.yaml. If " +
|
"the correct name of the executable in config.yaml. If " +
|
||||||
"you are using Debian or Ubuntu, it is probably avprobe.");
|
"you are using Debian or Ubuntu, it is probably avprobe.");
|
||||||
|
} else if (err.message) {
|
||||||
|
if (err.message.match(/protocol not found/i))
|
||||||
|
return cb("Link uses a protocol unsupported by this server's ffmpeg");
|
||||||
|
|
||||||
|
var m = err.message.match(/(http error .*)/i);
|
||||||
|
if (m) return cb(m[1]);
|
||||||
|
|
||||||
|
Logger.errlog.log(err.stack || err);
|
||||||
|
return cb("Unable to query file data with ffmpeg");
|
||||||
} else {
|
} else {
|
||||||
Logger.errlog.log(err.stack || err);
|
Logger.errlog.log(err.stack || err);
|
||||||
return cb("Unable to query file data with ffmpeg");
|
return cb("Unable to query file data with ffmpeg");
|
||||||
|
|
Loading…
Reference in a new issue