From 1f105c63748f3c2d5d35b84a5d99a5afd210d79a Mon Sep 17 00:00:00 2001 From: spaenleh Date: Wed, 4 Feb 2026 11:10:12 +0100 Subject: [PATCH 1/3] fix: add error page --- config/dev.exs | 3 ++- lib/admin_web/controllers/error_html.ex | 2 +- .../controllers/error_html/404.html.heex | 27 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 lib/admin_web/controllers/error_html/404.html.heex diff --git a/config/dev.exs b/config/dev.exs index 69a7c5a15..0520c7359 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -63,7 +63,8 @@ config :admin, AdminWeb.Endpoint, ~r"priv/pages/.*(md)$", ~r"lib/admin_web/(?:controllers|live|components|router)/?.*\.(ex|heex)$" ] - ] + ], + debug_errors: false # Enable dev routes for dashboard and mailbox config :admin, dev_routes: true diff --git a/lib/admin_web/controllers/error_html.ex b/lib/admin_web/controllers/error_html.ex index 3e08bd7b9..443f555e7 100644 --- a/lib/admin_web/controllers/error_html.ex +++ b/lib/admin_web/controllers/error_html.ex @@ -13,7 +13,7 @@ defmodule AdminWeb.ErrorHTML do # * lib/admin_web/controllers/error_html/404.html.heex # * lib/admin_web/controllers/error_html/500.html.heex # - # embed_templates "error_html/*" + embed_templates "error_html/*" def render("500.html", assigns) do case Sentry.get_last_event_id_and_source() do diff --git a/lib/admin_web/controllers/error_html/404.html.heex b/lib/admin_web/controllers/error_html/404.html.heex new file mode 100644 index 000000000..872bbdc7e --- /dev/null +++ b/lib/admin_web/controllers/error_html/404.html.heex @@ -0,0 +1,27 @@ + + + + + + Page not found + + + + +
+
+
+
+

Page Not Found

+ + {@conn.request_path} + +

Sorry, the page you are looking for does not exist.

+ Go back to Home Page +
+
+
+
+ + From 857098578ab26a4e7f2dc5e1dcbcd986ea21736c Mon Sep 17 00:00:00 2001 From: spaenleh Date: Fri, 6 Feb 2026 08:09:52 +0100 Subject: [PATCH 2/3] fix: page test --- lib/admin_web/controllers/error_html/404.html.heex | 2 +- test/admin_web/controllers/error_html_test.exs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/admin_web/controllers/error_html/404.html.heex b/lib/admin_web/controllers/error_html/404.html.heex index 872bbdc7e..a87cf4a13 100644 --- a/lib/admin_web/controllers/error_html/404.html.heex +++ b/lib/admin_web/controllers/error_html/404.html.heex @@ -3,7 +3,7 @@ - Page not found + Page Not Found diff --git a/test/admin_web/controllers/error_html_test.exs b/test/admin_web/controllers/error_html_test.exs index fe508095c..dcb26859f 100644 --- a/test/admin_web/controllers/error_html_test.exs +++ b/test/admin_web/controllers/error_html_test.exs @@ -4,8 +4,8 @@ defmodule AdminWeb.ErrorHTMLTest do # Bring render_to_string/4 for testing custom views import Phoenix.Template, only: [render_to_string: 4] - test "renders 404.html" do - assert render_to_string(AdminWeb.ErrorHTML, "404", "html", []) == "Not Found" + test "renders 404.html", %{conn: conn} do + assert render_to_string(AdminWeb.ErrorHTML, "404", "html", conn: conn) =~ "Page Not Found" end test "renders 500.html" do From c2b7c50c65638a91f5166cf7eb1d5677d8688881 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Fri, 6 Feb 2026 08:45:57 +0100 Subject: [PATCH 3/3] fix: disable debug errors --- config/dev.exs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/dev.exs b/config/dev.exs index 0520c7359..5cc0d5496 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -63,8 +63,11 @@ config :admin, AdminWeb.Endpoint, ~r"priv/pages/.*(md)$", ~r"lib/admin_web/(?:controllers|live|components|router)/?.*\.(ex|heex)$" ] - ], - debug_errors: false + ] + +# In development phoenix gives a lot of helpful information when there is a bug. +# Un-comment below to see something closed to the "real production environment" +# debug_errors: false # Enable dev routes for dashboard and mailbox config :admin, dev_routes: true