1
0
Fork 0
mirror of https://codeberg.org/ashley/poke.git synced 2024-11-17 04:14:39 -05:00

add try catch :p

This commit is contained in:
Ashley 2023-03-11 16:03:14 +00:00
parent 7057c6628a
commit ae0336ad05

View file

@ -86,7 +86,8 @@ async function video(v) {
);
var comments = await getJson(inv_comments);
} catch {
} catch (error) {
console.error("Error getting comments", error);
var comments = "";
}
@ -96,7 +97,7 @@ async function video(v) {
const videoInfo = await fetch(`${config.invapi}/videos/${v}`).then(res => res.text());
vid = await getJson(videoInfo);
} catch (error) {
console.error("Error getting video info", error);
}
@ -113,7 +114,8 @@ async function video(v) {
)
.then((res) => res.text())
.then((xml) => getJson(toJson(xml)));
} catch {
} catch (error) {
console.error("Error getting channel info", error);
var a = "";
}
@ -128,11 +130,15 @@ async function video(v) {
const data = await fetcher(v);
const nightlyJsonData = getJson(nightlyRes);
try {
const video = await fetch(`${config.tubeApi}video?v=${v}`)
.then((res) => res.text())
.then((xml) => getJson(toJson(xml)))
.catch(" ")
.catch(error => {
console.error("Error getting video", error);
return " ";
});
// Store result in cache
cache[v] = {
@ -155,6 +161,9 @@ async function video(v) {
};
return cache[v].result;
} catch (error) {
console.error("Error getting video", error);
}
}
}