ServiceStack.HttpResponseExtensionsInternal.WriteErrorBody C# (CSharp) Method

WriteErrorBody() public static method

When HTTP Headers have already been written and only the Body can be written
public static WriteErrorBody ( this httpRes, Exception ex ) : System.Threading.Tasks.Task
httpRes this
ex System.Exception
return System.Threading.Tasks.Task
        public static Task WriteErrorBody(this IResponse httpRes, Exception ex)
        {
            var req = httpRes.Request;
            var errorDto = ex.ToErrorResponse();
            HostContext.AppHost.OnExceptionTypeFilter(ex, errorDto.ResponseStatus);
            var serializer = HostContext.ContentTypes.GetResponseSerializer(MimeTypes.Html);
            serializer?.Invoke(req, errorDto, httpRes);
            httpRes.EndHttpHandlerRequest(skipHeaders: true);
            return TypeConstants.EmptyTask;
        }