Add error handling on bad schedule access
This commit is contained in:
parent
7d05a79ab3
commit
efe6250f38
10
app.js
10
app.js
@ -112,7 +112,14 @@ function getSchedule(type, code, station, way) {
|
|||||||
nextSchedule = setTimeout(function() {
|
nextSchedule = setTimeout(function() {
|
||||||
getSchedule(type, code, station, way);
|
getSchedule(type, code, station, way);
|
||||||
}, 15000);
|
}, 15000);
|
||||||
});
|
})
|
||||||
|
.fail(function(data) {
|
||||||
|
if (data.responseJSON && data.responseJSON.result && data.responseJSON.result.message)
|
||||||
|
{
|
||||||
|
$("#mainerror").text(data.responseJSON.result.message);
|
||||||
|
$("#mainerror").show();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function defineTag(type, station) {
|
function defineTag(type, station) {
|
||||||
@ -142,6 +149,7 @@ function main(uri, fetchTrafic) {
|
|||||||
$("#stations").attr("disabled", true);
|
$("#stations").attr("disabled", true);
|
||||||
$("#schedule").hide();
|
$("#schedule").hide();
|
||||||
$("#loading").hide();
|
$("#loading").hide();
|
||||||
|
$("#mainerror").hide();
|
||||||
|
|
||||||
if (nextTraffic != null) {
|
if (nextTraffic != null) {
|
||||||
clearTimeout(nextTraffic);
|
clearTimeout(nextTraffic);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body class="container">
|
<body class="container">
|
||||||
<h1 id="loading">Chargement en cours …</h1>
|
<h1 id="loading">Chargement en cours …</h1>
|
||||||
|
<h1 id="mainerror" style="display: none; color: red"></h1>
|
||||||
|
|
||||||
<form id="lines" style="display: none">
|
<form id="lines" style="display: none">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user