The Web API on error response includes stack trace and inner exception. Due to security reasons, we want to remove stack trace from error response.
May I know how to do these configurations?
This is existing sample error response:
{
"error":{
"code":"","message":"Resource not found for the segment '***_experienceses'.",
"innererror":{
"message":"Resource not found for the segment '***_experienceses'.",
"type":"Microsoft.OData.Core.UriParser.ODataUnrecognizedPathException",
"stacktrace":"at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.ParsePath(ICollection`1 segments)\r\n at Microsoft.OData.Core.UriParser.Parsers.ODataPathFactory.BindPath(ICollection`1 segments, ODataUriParserConfiguration configuration)\r\n at Microsoft.OData.Core.UriParser.ODataUriParser.Initialize()\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath, ODataUriResolverSetttings resolverSettings, Boolean enableUriTemplateParsing)\r\n at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)\r\n at Microsoft.Crm.Extensibility.OData.CrmODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)"
}
}
}
We want to be like that:
{
"error":{
"code":"","message":"Resource not found for the segment '***_experienceses'."
}
}