Improve queue fail error reporting

This commit is contained in:
Calvin Montgomery 2013-06-25 23:09:37 -04:00
parent 678abbd9da
commit d688a63bfa
4 changed files with 11 additions and 5 deletions

View File

@ -1051,7 +1051,9 @@ Channel.prototype.enqueue = function(data, user, callback) {
if(err) {
if(callback)
callback();
user.socket.emit("queueFail");
if(err === true)
err = false;
user.socket.emit("queueFail", err);
return;
}
media.queueby = user ? user.name : "";

View File

@ -29,7 +29,8 @@ function getJSON(options, callback) {
}
catch(e) {
Logger.errlog.log("JSON fail: " + options.path);
callback(true, res.statusCode, null);
var m = buffer.match(/<internalReason>([^<]+)<\/internalReason>/);
callback(m[1] || true, res.statusCode, null);
return;
}
callback(false, res.statusCode, data);
@ -53,7 +54,8 @@ function getJSONHTTPS(options, callback) {
}
catch(e) {
Logger.errlog.log("JSON fail: " + options.path);
callback(true, res.statusCode, null);
var m = buffer.match(/<internalReason>([^<]+)<\/internalReason>/);
callback(m[1] || true, res.statusCode, null);
return;
}
callback(false, res.statusCode, data);
@ -229,7 +231,7 @@ exports.getMedia = function(id, type, callback) {
case "yt":
exports.getYTInfo(id, function(err, res, data) {
if(err || res != 200) {
callback(true, null);
callback(err || true, null);
return;
}

View File

@ -159,7 +159,8 @@ exports.io.sockets.on("connection", function(socket) {
if(!Config.DEBUG) {
process.on("uncaughtException", function(err) {
Logger.errlog.log("[SEVERE] Uncaught Exception: " + err);
Logger.errlog.log("[SEVERE] Uncaught Exception: " + err);
Logger.errlog.log(err.stack);
});
process.on("exit", shutdown);

View File

@ -668,6 +668,7 @@ Callbacks = {
data = "Queue failed. Check your link to make sure it is valid.";
}
makeAlert("Error", data, "alert-error")
.addClass("span12")
.insertAfter($("#mediaurl").parent());
},