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;
}