diff --git a/config/dev.exs b/config/dev.exs index 69a7c5a15..5cc0d5496 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -65,6 +65,10 @@ config :admin, AdminWeb.Endpoint, ] ] +# 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 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..a87cf4a13 --- /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 +
+
+
+
+ + 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