mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-16 02:22:07 -05:00
error handling
This commit is contained in:
parent
cb1c9dd7eb
commit
78531c08d5
@ -22,6 +22,7 @@ $.getJSON("/games.json", function (data) {
|
||||
$("<img>").prop({
|
||||
src: data[i].directory + "/" + data[i].image,
|
||||
alt: data[i].name + " logo",
|
||||
onerror: "failedImg($(this));",
|
||||
})
|
||||
)
|
||||
.append($("<h1>").text(data[i].name))
|
||||
@ -41,6 +42,7 @@ $.getJSON("/games.json", function (data) {
|
||||
if ($("#pinnedgames #message")) {
|
||||
$("#pinnedmessage").hide();
|
||||
}
|
||||
$element.addEventListener("error", imageNotFound);
|
||||
}
|
||||
|
||||
$("#games").append($element);
|
||||
@ -84,6 +86,7 @@ $(document).ready(function () {
|
||||
$("<img>").prop({
|
||||
src: pinnedarraynodes[0].src,
|
||||
alt: pinnedarraynodes[0].alt,
|
||||
class: "gameicon"
|
||||
})
|
||||
)
|
||||
.append($("<h1>").text(pinnedarraynodes[1].innerHTML))
|
||||
|
20
js/main.js
20
js/main.js
@ -13,3 +13,23 @@ function check() {
|
||||
window.onload = function () {
|
||||
interval = setInterval(check, 50);
|
||||
};
|
||||
|
||||
window.addEventListener("error", function (event) {
|
||||
if (event.target instanceof HTMLImageElement) {
|
||||
alert(
|
||||
"Error: Image failed to load." +
|
||||
"\nFull Image URL: " + event.target.src +
|
||||
'\nPlease copy this error message and click "Report a Bug" or go to https://forms.gle/j75WUn6UhdqsRZgf7'
|
||||
)
|
||||
event.target.src = "favicon.png";
|
||||
} else {
|
||||
alert (
|
||||
"Error: " + event.message +
|
||||
"\nScript: " + event.filename +
|
||||
"\nLine: " + event.lineno +
|
||||
"\nColumn: " + event.colno +
|
||||
"\nStackTrace: " + event.error +
|
||||
'\nPlease copy this error message and click "Report a Bug" or go to https://forms.gle/j75WUn6UhdqsRZgf7'
|
||||
);
|
||||
}
|
||||
}, true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user