ServiceStack.HttpResponseExtensionsInternal.HandleCustomErrorHandler C# (CSharp) Méthode

HandleCustomErrorHandler() private static méthode

private static HandleCustomErrorHandler ( this httpRes, IRequest httpReq, string contentType, int statusCode, object errorDto ) : bool
httpRes this
httpReq IRequest
contentType string
statusCode int
errorDto object
Résultat bool
        private static bool HandleCustomErrorHandler(this IResponse httpRes, IRequest httpReq,
            string contentType, int statusCode, object errorDto)
        {
            if (httpReq != null && MimeTypes.Html.MatchesContentType(contentType))
            {
                var errorHandler = HostContext.AppHost.GetCustomErrorHandler(statusCode)
                    ?? HostContext.AppHost.GlobalHtmlErrorHttpHandler;
                if (errorHandler != null)
                {
                    httpReq.Items["Model"] = errorDto;
                    httpReq.Items[HtmlFormat.ErrorStatusKey] = errorDto.GetResponseStatus();
                    errorHandler.ProcessRequest(httpReq, httpRes, httpReq.OperationName);
                    return true;
                }
            }
            return false;
        }