mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 17:58:17 +01:00
use the initerr function owo
This commit is contained in:
parent
4ced593d75
commit
0668ca9ab7
1 changed files with 9 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue