diff options
-rw-r--r-- | fietsboek/views/tileproxy.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fietsboek/views/tileproxy.py b/fietsboek/views/tileproxy.py index ff68e30..cbd84f0 100644 --- a/fietsboek/views/tileproxy.py +++ b/fietsboek/views/tileproxy.py @@ -229,8 +229,14 @@ def tile_proxy(request): LOGGER.debug("Proxy timeout when accessing %r", url) request.redis.incr(timeout_tracker) request.redis.expire(timeout_tracker, PUNISHMENT_TTL) - return HTTPGatewayTimeout(f"No response in time from {url}") + return HTTPGatewayTimeout(f"No response in time from {provider}") else: + try: + resp.raise_for_status() + except requests.HTTPError as exc: + LOGGER.info("Proxy request failed for %s: %s", provider, exc) + return Response(f"Failed to get tile from {provider}", + status_code=resp.status_code) request.redis.set(cache_key, resp.content, ex=TTL) return Response(resp.content, content_type=resp.headers.get("Content-type", content_type)) |