diff --git a/CHANGELOG.md b/CHANGELOG.md index b4f76165..1135be00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ All notable changes to this project will be documented in this file. - Don't trigger "down" notifications when changing schedule interactively in web UI - Fix sendalerts crash loop when encountering a bad cron schedule - Stricter cron validation, reject schedules like "At midnight of February 31" -- In hc.front.views.ping_details, if a ping does not exist, return 404 instead of 500 +- In hc.front.views.ping_details, if a ping does not exist, return a friendly message ## v1.12.0 - 2020-01-02 diff --git a/hc/front/tests/test_ping_details.py b/hc/front/tests/test_ping_details.py index 3177a48b..6761daf8 100644 --- a/hc/front/tests/test_ping_details.py +++ b/hc/front/tests/test_ping_details.py @@ -58,4 +58,4 @@ class LastPingTestCase(BaseTestCase): self.client.login(username="alice@example.org", password="password") r = self.client.get("/checks/%s/pings/123/" % check.code) - self.assertEqual(r.status_code, 404) + self.assertContains(r, "No additional information is", status_code=200) diff --git a/hc/front/views.py b/hc/front/views.py index 1a89b925..ac052302 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -427,7 +427,7 @@ def ping_details(request, code, n=None): try: ping = q.latest("created") except Ping.DoesNotExist: - raise Http404("not found") + return render(request, "front/ping_details_not_found.html") ctx = {"check": check, "ping": ping} diff --git a/templates/front/ping_details_not_found.html b/templates/front/ping_details_not_found.html new file mode 100644 index 00000000..80fc3ebd --- /dev/null +++ b/templates/front/ping_details_not_found.html @@ -0,0 +1,4 @@ +
No additional information is available for this event.
+