2023-04-13 23:29:29 -04:00
|
|
|
defmodule MemexWeb.ErrorHTML do
|
|
|
|
use MemexWeb, :html
|
2021-03-11 21:12:55 -05:00
|
|
|
|
2023-04-13 23:29:29 -04:00
|
|
|
embed_templates "error_html/*"
|
|
|
|
|
|
|
|
def render(template, _assigns) do
|
2022-02-25 21:53:04 -05:00
|
|
|
error_string =
|
2023-04-13 23:29:29 -04:00
|
|
|
case template do
|
2022-11-26 14:51:18 -05:00
|
|
|
"404.html" -> dgettext("errors", "not found")
|
|
|
|
"401.html" -> dgettext("errors", "unauthorized")
|
2023-02-04 17:36:27 -05:00
|
|
|
_other_path -> dgettext("errors", "internal server error")
|
2022-02-25 21:53:04 -05:00
|
|
|
end
|
2021-03-11 21:12:55 -05:00
|
|
|
|
2023-04-13 23:29:29 -04:00
|
|
|
error(%{error_string: error_string})
|
2021-03-11 21:12:55 -05:00
|
|
|
end
|
|
|
|
end
|