logging: only return ISE reasons in API responses when in dev or test mode
authorWilliam Pitcock <nenolod@dereferenced.org>
Wed, 20 Feb 2019 17:36:19 +0000 (17:36 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Wed, 20 Feb 2019 17:36:47 +0000 (17:36 +0000)
lib/pleroma/web/views/error_view.ex

index aefc844fd51db7b9e9b0f283ce8e32adc36a80ca..f4c04131c949708251e4bdd95a045ecd02f7c1d3 100644 (file)
@@ -13,7 +13,11 @@ defmodule Pleroma.Web.ErrorView do
   def render("500.json", assigns) do
     Logger.error("Internal server error: #{inspect(assigns[:reason])}")
 
-    %{errors: %{detail: "Internal server error", reason: inspect(assigns[:reason])}}
+    if Mix.env() != :prod do
+      %{errors: %{detail: "Internal server error", reason: inspect(assigns[:reason])}}
+    else
+      %{errors: %{detail: "Internal server error"}}
+    end
   end
 
   # In case no render clause matches or no