Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/admin_web/controllers/error_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions lib/admin_web/controllers/error_html/404.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Page Not Found</title>
<link rel="stylesheet" href="/assets/css/app.css" />
<script defer type="text/javascript" src="/assets/js/app.js">
</script>
</head>
<body class="flex flex-col min-h-screen">
<main class="flex-1 grow flex flex-col">
<section class="hero bg-base-200 h-full grow">
<div class="hero-content text-center">
<div class="max-w-md flex flex-col">
<h1 class="text-5xl font-bold">Page Not Found</h1>
<code class="code">
{@conn.request_path}
</code>
<p class="py-6">Sorry, the page you are looking for does not exist.</p>
<a href="/" class="btn btn-primary">Go back to Home Page</a>
</div>
</div>
</section>
</main>
</body>
</html>
4 changes: 2 additions & 2 deletions test/admin_web/controllers/error_html_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading