Better error reporting for queue fails (404)

This commit is contained in:
calzoneman 2013-08-01 10:12:22 -04:00
parent 329505de9d
commit 51e48e924d

View file

@ -91,7 +91,13 @@ var Getters = {
}; };
urlRetrieve(https, options, function (status, data) { urlRetrieve(https, options, function (status, data) {
if(status !== 200) { if(status === 404) {
callback("Video not found", null);
return;
} else if(status === 403) {
callbacK("Private video", null);
return;
} else if(status !== 200) {
callback(true, null); callback(true, null);
return; return;
} }
@ -140,7 +146,13 @@ var Getters = {
}; };
urlRetrieve(https, options, function (status, data) { urlRetrieve(https, options, function (status, data) {
if(status !== 200) { if(status === 404) {
callback("Video not found", null);
return;
} else if(status === 403) {
callbacK("Private video", null);
return;
} else if(status !== 200) {
callback(true, null); callback(true, null);
return; return;
} }
@ -189,11 +201,13 @@ var Getters = {
data = JSON.parse(data); data = JSON.parse(data);
var title = data.title; var title = data.title;
var seconds = data.duration; var seconds = data.duration;
if(title === "Deleted video" && seconds === 10) {
callback("Video not found", null);
return;
}
var media = new Media(id, title, seconds, "dm"); var media = new Media(id, title, seconds, "dm");
callback(false, media); callback(false, media);
} catch(e) { } catch(e) {
// TODO See what kinds of errors DM returns
var err = true;
callback(err, null); callback(err, null);
} }
}); });
@ -219,7 +233,10 @@ var Getters = {
}; };
urlRetrieve(https, options, function (status, data) { urlRetrieve(https, options, function (status, data) {
if(status !== 302) { if(status === 404) {
callback("Sound not found", null);
return;
} else if(status !== 302) {
callback(true, null); callback(true, null);
return; return;
} }