From d5fdc0855a48536492eaed2d2a9055fafd898a30 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 17 Mar 2014 00:24:29 +0000 Subject: [PATCH] Add an error handler for overpass AJAX calls --- app/assets/javascripts/index/query.js | 7 +++++++ config/locales/en.yml | 2 ++ 2 files changed, 9 insertions(+) diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index d9906407d..f2281d007 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -198,6 +198,13 @@ OSM.Query = function(map) { .text(I18n.t("javascripts.query.nothing_found")) .appendTo($ul); } + }, + error: function(xhr, status, error) { + $section.find(".loader").stopTime("loading").hide(); + + $("
  • ") + .text(I18n.t("javascripts.query." + status, { server: OSM.OVERPASS_URL, error: error })) + .appendTo($ul); } })); } diff --git a/config/locales/en.yml b/config/locales/en.yml index c4f757b76..3e452571b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2127,6 +2127,8 @@ en: way: Way relation: Relation nothing_found: No features found + error: "Error contacting %{server}: %{error}" + timeout: "Timeout contacting %{server}" redaction: edit: description: "Description" -- 2.43.2