Merge pull request #11823 from umbraco/v8/bugfix/dont_show_stacktrace_in_production_mode
Don't show stack trace in production mode
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Web.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.Filters;
|
||||
|
||||
@@ -11,7 +12,14 @@ namespace Umbraco.Web.WebApi
|
||||
{
|
||||
public override void OnActionExecuting(HttpActionContext actionContext)
|
||||
{
|
||||
actionContext.ControllerContext.Configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
|
||||
if (HttpContext.Current?.IsDebuggingEnabled ?? false)
|
||||
{
|
||||
actionContext.ControllerContext.Configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
|
||||
}
|
||||
else
|
||||
{
|
||||
actionContext.ControllerContext.Configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user