mirror of https://github.com/calzoneman/sync.git
Error handling for google+
This commit is contained in:
parent
937ad04967
commit
69772bf2ec
|
@ -810,18 +810,19 @@ var Getters = {
|
||||||
case 200:
|
case 200:
|
||||||
break; /* Request is OK, skip to handling data */
|
break; /* Request is OK, skip to handling data */
|
||||||
case 400:
|
case 400:
|
||||||
return callback("Invalid request", null);
|
return cb("Invalid request", null);
|
||||||
case 403:
|
case 403:
|
||||||
return callback("Private video", null);
|
return cb("Private video", null);
|
||||||
case 404:
|
case 404:
|
||||||
return callback("Video not found", null);
|
return cb("Video not found", null);
|
||||||
case 500:
|
case 500:
|
||||||
case 503:
|
case 503:
|
||||||
return callback("Service unavailable", null);
|
return cb("Service unavailable", null);
|
||||||
default:
|
default:
|
||||||
return callback("HTTP " + status, null);
|
return cb("HTTP " + status, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
var videos = {};
|
var videos = {};
|
||||||
var duration;
|
var duration;
|
||||||
var title;
|
var title;
|
||||||
|
@ -892,8 +893,23 @@ var Getters = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Object.keys(direct).length === 0) {
|
||||||
|
return cb("Unable to retrieve video data from Google+. Check that " +
|
||||||
|
"the album exists and is shared publicly.");
|
||||||
|
} else if (!title) {
|
||||||
|
return cb("Unable to retrieve title from Google+. Check that " +
|
||||||
|
"the album exists and is shared publicly.");
|
||||||
|
} else if (!duration) {
|
||||||
|
return cb("Unable to retreive duration from Google+. This might be " +
|
||||||
|
"because the video is still processing.");
|
||||||
|
}
|
||||||
|
|
||||||
var media = new Media(id, title, duration, "gp", { gpdirect: direct });
|
var media = new Media(id, title, duration, "gp", { gpdirect: direct });
|
||||||
cb(null, media);
|
cb(null, media);
|
||||||
|
} catch (e) {
|
||||||
|
cb("Unknown error");
|
||||||
|
Logger.errlog.log("Unknown error for Google+ ID " + id + ": " + e.trace);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue