diff --git a/lib/cannery_web/templates/error/error.html.heex b/lib/cannery_web/templates/error/error.html.heex
new file mode 100644
index 00000000..cc396286
--- /dev/null
+++ b/lib/cannery_web/templates/error/error.html.heex
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+ <%= dgettext("errors", "Error") %> | Cannery
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/cannery_web/templates/layout/root.html.heex b/lib/cannery_web/templates/layout/root.html.heex
index 062796a1..a8ae8ac7 100644
--- a/lib/cannery_web/templates/layout/root.html.heex
+++ b/lib/cannery_web/templates/layout/root.html.heex
@@ -1,5 +1,5 @@
-
+
@@ -15,7 +15,7 @@
>
-
+
<%= @inner_content %>
diff --git a/lib/cannery_web/views/error_view.ex b/lib/cannery_web/views/error_view.ex
index 5f152f61..debdefff 100644
--- a/lib/cannery_web/views/error_view.ex
+++ b/lib/cannery_web/views/error_view.ex
@@ -1,16 +1,15 @@
defmodule CanneryWeb.ErrorView do
use CanneryWeb, :view
+ alias CanneryWeb.{Endpoint, HomeLive}
- # If you want to customize a particular status code
- # for a certain format, you may uncomment below.
- # def render("500.html", _assigns) do
- # "Internal Server Error"
- # end
+ def template_not_found(error_path, _assigns) do
+ error_string =
+ case error_path do
+ "404.html" -> dgettext("errors", "Not found")
+ "401.html" -> dgettext("errors", "Unauthorized")
+ _ -> dgettext("errors", "Internal Server Error")
+ end
- # By default, Phoenix returns the status message from
- # the template name. For example, "404.html" becomes
- # "Not Found".
- def template_not_found(template, _assigns) do
- Phoenix.Controller.status_message_from_template(template)
+ render("error.html", %{error_string: error_string})
end
end
diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot
index 63fa85a5..32ee711b 100644
--- a/priv/gettext/errors.pot
+++ b/priv/gettext/errors.pot
@@ -119,3 +119,28 @@ msgstr ""
#: lib/cannery/accounts/user.ex:82
msgid "must have the @ sign and no spaces"
msgstr ""
+
+#, elixir-format, ex-autogen
+#: lib/cannery_web/templates/error/error.html.heex:8
+msgid "Error"
+msgstr ""
+
+#, elixir-format, ex-autogen
+#: lib/cannery_web/views/error_view.ex:10
+msgid "Internal Server Error"
+msgstr ""
+
+#, elixir-format, ex-autogen
+#: lib/cannery_web/views/error_view.ex:8
+msgid "Not found"
+msgstr ""
+
+#, elixir-format, ex-autogen
+#: lib/cannery_web/views/error_view.ex:9
+msgid "Unauthorized"
+msgstr ""
+
+#, elixir-format, ex-autogen
+#: lib/cannery_web/templates/error/error.html.heex:25
+msgid "Go back home"
+msgstr ""