aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fietsboek/data.py3
-rw-r--r--fietsboek/views/tileproxy.py5
2 files changed, 7 insertions, 1 deletions
diff --git a/fietsboek/data.py b/fietsboek/data.py
index 72d607a..5dab9bc 100644
--- a/fietsboek/data.py
+++ b/fietsboek/data.py
@@ -3,6 +3,9 @@
Data are objects that belong to a track (such as images), but are not stored in
the database itself. This module makes access to such data objects easier.
"""
+# We don't have onexc yet in all supported versions, so let's ignore the
+# deprecation for now and stick with onerror:
+# pylint: disable=deprecated-argument
import datetime
import logging
import os
diff --git a/fietsboek/views/tileproxy.py b/fietsboek/views/tileproxy.py
index 44ae808..999b04f 100644
--- a/fietsboek/views/tileproxy.py
+++ b/fietsboek/views/tileproxy.py
@@ -353,7 +353,10 @@ def tile_proxy(request):
raise HTTPGatewayTimeout(f"No response in time from {provider}") from None
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=exc.response.status_code)
+ status_code = 400
+ if exc.response:
+ status_code = exc.response.status_code
+ return Response(f"Failed to get tile from {provider}", status_code=status_code)
else:
request.redis.set(cache_key, resp.content, ex=TTL)
return Response(resp.content, content_type=resp.headers.get("Content-type", content_type))