Improve handling of HTTP errors in search

Fixes #969
This commit is contained in:
Tom Hughes 2015-05-14 09:21:19 +01:00
parent 14d4b9206c
commit b4caac4d49
2 changed files with 8 additions and 1 deletions

View file

@ -978,6 +978,7 @@ header .search_forms,
.search_results_error {
color: #f00;
padding: 10px 20px;
}
/* Rules for routing */

View file

@ -286,7 +286,13 @@ class GeocoderController < ApplicationController
private
def fetch_text(url)
OSM.http_client.get(URI.parse(url)).body
response = OSM.http_client.get(URI.parse(url))
if response.success?
response.body
else
fail response.status.to_s
end
end
def fetch_xml(url)