mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
Fix JSON error pages
This commit is contained in:
parent
1a375a91bd
commit
b1da5afac0
1 changed files with 14 additions and 8 deletions
|
@ -25,13 +25,19 @@ defmodule PhilomenaWeb.ErrorView do
|
||||||
def render(template, assigns) when template != "show.html" do
|
def render(template, assigns) when template != "show.html" do
|
||||||
{short_msg, long_msg} = @codes[assigns.status] || @codes[500]
|
{short_msg, long_msg} = @codes[assigns.status] || @codes[500]
|
||||||
|
|
||||||
render(
|
case Phoenix.Controller.get_format(assigns.conn) do
|
||||||
PhilomenaWeb.ErrorView,
|
"json" ->
|
||||||
"show.html",
|
%{"error" => short_msg}
|
||||||
conn: assigns.conn,
|
|
||||||
status: assigns.status,
|
_ ->
|
||||||
short_msg: short_msg,
|
render(
|
||||||
long_msg: long_msg
|
PhilomenaWeb.ErrorView,
|
||||||
)
|
"show.html",
|
||||||
|
conn: assigns.conn,
|
||||||
|
status: assigns.status,
|
||||||
|
short_msg: short_msg,
|
||||||
|
long_msg: long_msg
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue