From e420e51b7d05d34ea8d54cb5f0d8dbaa8683ec35 Mon Sep 17 00:00:00 2001 From: Maygician Date: Mon, 5 Oct 2020 22:55:00 +0700 Subject: [PATCH] error codes --- lp/lib/lp_web/templates/error/404.html.eex | 1 + lp/lib/lp_web/templates/error/500.html.eex | 2 ++ lp/lib/lp_web/views/error_view.ex | 10 +++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 lp/lib/lp_web/templates/error/404.html.eex create mode 100644 lp/lib/lp_web/templates/error/500.html.eex diff --git a/lp/lib/lp_web/templates/error/404.html.eex b/lp/lib/lp_web/templates/error/404.html.eex new file mode 100644 index 0000000..79c4fa5 --- /dev/null +++ b/lp/lib/lp_web/templates/error/404.html.eex @@ -0,0 +1 @@ +

404

\ No newline at end of file diff --git a/lp/lib/lp_web/templates/error/500.html.eex b/lp/lib/lp_web/templates/error/500.html.eex new file mode 100644 index 0000000..fe5c8bf --- /dev/null +++ b/lp/lib/lp_web/templates/error/500.html.eex @@ -0,0 +1,2 @@ +

500

+

There was an error. Sadly.

diff --git a/lp/lib/lp_web/views/error_view.ex b/lp/lib/lp_web/views/error_view.ex index 272cbac..848aa65 100644 --- a/lp/lib/lp_web/views/error_view.ex +++ b/lp/lib/lp_web/views/error_view.ex @@ -3,9 +3,13 @@ defmodule LpWeb.ErrorView do # 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 render("404.html", _assigns) do + render("404.html", %{}) + end + def render("500.html", _assigns) do + render("500.html", %{}) + # "Internal Server Error" + end # By default, Phoenix returns the status message from # the template name. For example, "404.html" becomes