From 951b306cff27e89eaabc12f44f313bc155e685ad Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Fri, 23 Aug 2024 10:39:15 -0700 Subject: [PATCH] Added an improved error message screen with actionable details --- config/config.exs | 3 +- lib/pinchflat_web/controllers/error_html.ex | 9 +----- .../controllers/error_html/500.html.heex | 29 +++++++++++++++++++ 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 lib/pinchflat_web/controllers/error_html/500.html.heex diff --git a/config/config.exs b/config/config.exs index 84f85cb..7df3a77 100644 --- a/config/config.exs +++ b/config/config.exs @@ -41,7 +41,8 @@ config :pinchflat, PinchflatWeb.Endpoint, adapter: Phoenix.Endpoint.Cowboy2Adapter, render_errors: [ formats: [html: PinchflatWeb.ErrorHTML, json: PinchflatWeb.ErrorJSON], - layout: false + root_layout: {PinchflatWeb.Layouts, :root}, + layout: {PinchflatWeb.Layouts, :app} ], pubsub_server: Pinchflat.PubSub, live_view: [signing_salt: "/t5878kO"] diff --git a/lib/pinchflat_web/controllers/error_html.ex b/lib/pinchflat_web/controllers/error_html.ex index 7fdeb0a..6a6e689 100644 --- a/lib/pinchflat_web/controllers/error_html.ex +++ b/lib/pinchflat_web/controllers/error_html.ex @@ -1,14 +1,7 @@ defmodule PinchflatWeb.ErrorHTML do use PinchflatWeb, :html - # If you want to customize your error pages, - # uncomment the embed_templates/1 call below - # and add pages to the error directory: - # - # * lib/pinchflat_web/controllers/error_html/404.html.heex - # * lib/pinchflat_web/controllers/error_html/500.html.heex - # - # embed_templates "error_html/*" + embed_templates "error_html/*" # The default is to render a plain text page based on # the template name. For example, "404.html" becomes diff --git a/lib/pinchflat_web/controllers/error_html/500.html.heex b/lib/pinchflat_web/controllers/error_html/500.html.heex new file mode 100644 index 0000000..1134520 --- /dev/null +++ b/lib/pinchflat_web/controllers/error_html/500.html.heex @@ -0,0 +1,29 @@ +
+

Internal Server Error

+

+ This shouldn't happen! Please make a + <.inline_link href="https://github.com/kieraneglin/pinchflat/issues/new/choose">GitHub issue + with the following information: +

+ + + +