Add some error feedback
This commit is contained in:
parent
a5784d8aa8
commit
5627f27562
@ -9,16 +9,9 @@ $("body").on("submit", "#wordbox-searchbar", function (e) {
|
||||
dolookup($("#wordbox").val());
|
||||
return false;
|
||||
});
|
||||
//
|
||||
//$("body").on("keypress", "#wordbox", function (e) {
|
||||
// if (e.which == 13) {
|
||||
// dolookup($(this).val());
|
||||
// }
|
||||
// return false;
|
||||
//});
|
||||
|
||||
function dolookup(words) {
|
||||
//try {
|
||||
try {
|
||||
words = words.trim().toLowerCase().replace(/\s+/g, ' ');
|
||||
|
||||
if (!/^[a-z ]+?$/i.test(words)) {
|
||||
@ -50,7 +43,7 @@ function dolookup(words) {
|
||||
break;
|
||||
}
|
||||
map.animateMapIn(coords[0], coords[1], zoomlevel);
|
||||
// } catch (e) {
|
||||
// alert(e);
|
||||
// }
|
||||
} catch (e) {
|
||||
app.dialog.alert(e, "Error");
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ function createMap() {
|
||||
} else {
|
||||
console.log("maplibre-gl not supported, disabling map");
|
||||
$("#mapbox").css("display", "none");
|
||||
// TODO: show error to user
|
||||
app.dialog.alert("Your device does not support the 3D graphics needed to show the map.", "Unsupported Device");
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ function reloadMap() {
|
||||
// oh well ¯\(°_o)/¯
|
||||
console.log(ex);
|
||||
$("#mapbox").css("display", "none");
|
||||
app.dialog.alert("There was a problem loading the map. Error message: " + ex, "Error");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,8 @@ function maplibreMap() {
|
||||
var latitude = (Math.round(coordinates.lat * 10000) / 10000);
|
||||
var longitude = (Math.round(coordinates.lng * 10000) / 10000);
|
||||
lookupAndShowCoords(latitude, longitude);
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
} catch (ex) {
|
||||
alert(ex);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user