cannery/lib/cannery_web/controllers/error_json.ex
shibao 668e4c611b
Some checks failed
continuous-integration/drone/push Build is failing
update gettext schema and use macros for cannery app
2024-10-26 17:07:32 -04:00

15 lines
394 B
Elixir

defmodule CanneryWeb.ErrorJSON do
use Gettext, backend: CanneryWeb.Gettext
def render(template, _assigns) do
error_string =
case template do
"404.json" -> dgettext("errors", "Not found")
"401.json" -> dgettext("errors", "Unauthorized")
_other_path -> dgettext("errors", "Internal server error")
end
%{errors: %{detail: error_string}}
end
end