use the initerr function owo

This commit is contained in:
Ashley 2023-04-19 22:10:18 +00:00
parent 4ced593d75
commit 0668ca9ab7

View file

@ -29,6 +29,11 @@ const config = {
t_url: "https://t.poketube.fun/", // def matomo url t_url: "https://t.poketube.fun/", // def matomo url
}; };
function initerr(args){
console.error("[LIBPT CORE ERROR]" + args)
}
// Util functions // Util functions
function getJson(str) { function getJson(str) {
try { try {
@ -87,7 +92,7 @@ async function video(v) {
var comments = await getJson(inv_comments); var comments = await getJson(inv_comments);
} catch (error) { } catch (error) {
console.error("Error getting comments", error); initerr("Error getting comments", error);
var comments = ""; var comments = "";
} }
@ -99,7 +104,7 @@ async function video(v) {
); );
vid = await getJson(videoInfo); vid = await getJson(videoInfo);
} catch (error) { } catch (error) {
console.error("Error getting video info", error); initerr("Error getting video info", error);
} }
if (!vid) { if (!vid) {
@ -118,7 +123,7 @@ async function video(v) {
.then((res) => res.text()) .then((res) => res.text())
.then((xml) => getJson(toJson(xml))); .then((xml) => getJson(toJson(xml)));
} catch (error) { } catch (error) {
console.error("Error getting channel info", error); initerr("Error getting channel info", error);
var a = ""; var a = "";
} }
@ -167,7 +172,7 @@ async function video(v) {
return cache[v].result; return cache[v].result;
} catch (error) { } catch (error) {
console.error("Error getting video", error); initerr("Error getting video", error);
} }
} }
} }