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