diff --git a/elixir/apps/web/lib/web/controllers/error_controller.ex b/elixir/apps/web/lib/web/controllers/error_controller.ex new file mode 100644 index 000000000..5fe119d1d --- /dev/null +++ b/elixir/apps/web/lib/web/controllers/error_controller.ex @@ -0,0 +1,13 @@ +defmodule Web.ErrorController do + use Web, :controller + + def show(_conn, params) do + case params["code"] do + "404" -> raise Web.LiveErrors.NotFoundError + "422" -> raise Web.LiveErrors.InvalidRequestError + "500" -> raise "internal server error" + end + + raise "unknown error" + end +end diff --git a/elixir/apps/web/lib/web/controllers/error_html.ex b/elixir/apps/web/lib/web/controllers/error_html.ex index 4edc23f26..9db65969d 100644 --- a/elixir/apps/web/lib/web/controllers/error_html.ex +++ b/elixir/apps/web/lib/web/controllers/error_html.ex @@ -8,7 +8,7 @@ defmodule Web.ErrorHTML do # * lib/web_web/controllers/error_html/404.html.heex # * lib/web_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/elixir/apps/web/lib/web/controllers/error_html/404.html.heex b/elixir/apps/web/lib/web/controllers/error_html/404.html.heex new file mode 100644 index 000000000..546b6465d --- /dev/null +++ b/elixir/apps/web/lib/web/controllers/error_html/404.html.heex @@ -0,0 +1,42 @@ + + +
+ + + + + + + + + +Sorry, we couldn't find this page.
++ Something went wrong. We've already been notified and will get it fixed as soon as possible. +
++ Something went wrong. We've already been notified and will get it fixed as soon as possible. +
+