From 22e2ed235d9e7ebaab313462d0d0a9fa040cd44f Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 20 Feb 2019 17:36:19 +0000 Subject: [PATCH] logging: only return ISE reasons in API responses when in dev or test mode --- lib/pleroma/web/views/error_view.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/views/error_view.ex b/lib/pleroma/web/views/error_view.ex index aefc844fd..f4c04131c 100644 --- a/lib/pleroma/web/views/error_view.ex +++ b/lib/pleroma/web/views/error_view.ex @@ -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 -- 2.45.2