1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 17:26:37 -04:00

catch and log lambda errors

This commit is contained in:
2021-05-30 09:58:29 -04:00
parent ba81de8765
commit 1d76ff93ad
2 changed files with 70 additions and 53 deletions

View File

@ -18,14 +18,22 @@
fetch("/api/hits?slug=" + slug)
.then((response) => response.json())
.then((data) => {
// finally inject the hits and hide the loading spinner
var spinner = document.getElementById("hit-spinner");
var counter = document.getElementById("hit-counter");
if (typeof data.hits !== "undefined") {
// finally inject the hits and hide the loading spinner
var spinner = document.getElementById("hit-spinner");
var counter = document.getElementById("hit-counter");
spinner.style.display = "none";
wrapper.title = data.pretty_hits + " " + data.pretty_unit;
counter.appendChild(document.createTextNode(data.pretty_hits));
spinner.style.display = "none";
wrapper.title = data.pretty_hits + " " + data.pretty_unit;
counter.appendChild(document.createTextNode(data.pretty_hits));
} else {
// something went horribly wrong, initiate coverup
wrapper.style.display = "none";
}
})
.catch((error) => {});
.catch((error) => {
// something went horribly wrong, initiate coverup
wrapper.style.display = "none";
});
}
})();