aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dennis Pham <[email protected]>2020-06-22 16:10:25 -0400
committerGravatar GitHub <[email protected]>2020-06-22 16:10:25 -0400
commit61ea5ad7439b43d80d6e2184fd663924a5a7dcc7 (patch)
treee40404c3b2362b949be0ce2435734d27303aae43
parentFix trailing whitespace in GitHub Action file (diff)
Catch ConnectionError when trying to get updated repository data
This will prevent a 500 server error on our homepage when GitHub's API is down, allowing us to use the cached data we have instead.
-rw-r--r--pydis_site/apps/home/views/home.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py
index 79c7695b..20e38ab0 100644
--- a/pydis_site/apps/home/views/home.py
+++ b/pydis_site/apps/home/views/home.py
@@ -61,7 +61,7 @@ class HomeView(View):
# Try to get new data from the API. If it fails, return the cached data.
try:
api_repositories = self._get_api_data()
- except TypeError:
+ except (TypeError, ConnectionError):
return RepositoryMetadata.objects.all()
database_repositories = []