Added more info on faulty input

- Sent in the results on REST
- Sent in the update_required msg on socket.io connection
This commit is contained in:
Kasper Rynning-Tønnesen
2018-03-06 13:02:53 +01:00
parent 43af39c03a
commit d757b95b44
11 changed files with 728 additions and 617 deletions

View File

@@ -69,7 +69,17 @@ function get_correct_info(song_generated, channel, broadcast, callback) {
function check_error_video(msg, channel) {
if(!msg.hasOwnProperty("id") || !msg.hasOwnProperty("title") ||
typeof(msg.id) != "string" || typeof(msg.title) != "string") {
socket.emit("update_required");
var result = {
id: {
expected: "string",
got: msg.hasOwnProperty("id") ? typeof(msg.id) : undefined,
},
title: {
expected: "string",
got: msg.hasOwnProperty("title") ? typeof(msg.title) : undefined,
},
};
socket.emit("update_required", result);
return;
}