U4-8755 - more explicit errors when xml cache is corrupt

This commit is contained in:
Stephan
2016-07-21 16:46:46 +02:00
parent b290e6af8a
commit 32d59bb2bc
5 changed files with 37 additions and 19 deletions

View File

@@ -409,7 +409,10 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
internal XmlDocument GetXml(UmbracoContext umbracoContext, bool preview)
{
return GetXmlDelegate(umbracoContext, preview);
var xml = GetXmlDelegate(umbracoContext, preview);
if (xml == null)
throw new Exception("The Xml cache is corrupt. Use the Health Check data integrity dashboard to fix it.");
return xml;
}
#endregion

View File

@@ -8,7 +8,6 @@ using Umbraco.Web.Routing;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Cache;

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Umbraco.Core.Models;
using umbraco;
using Umbraco.Core.Logging;
namespace Umbraco.Web.Routing
{
@@ -30,8 +31,17 @@ namespace Umbraco.Web.Routing
return urls;
}
string url;
var urlProvider = umbracoContext.RoutingContext.UrlProvider;
var url = urlProvider.GetUrl(content.Id);
try
{
url = urlProvider.GetUrl(content.Id);
}
catch (Exception e)
{
LogHelper.Error<UrlProvider>("GetUrl exception.", e);
url = "#ex";
}
if (url == "#")
{
// document as a published version yet it's url is "#" => a parent must be
@@ -48,6 +58,10 @@ namespace Umbraco.Web.Routing
else
urls.Add(ui.Text("content", "parentNotPublished", parent.Name, umbracoContext.Security.CurrentUser));
}
else if (url == "#ex")
{
urls.Add(ui.Text("content", "getUrlException", umbracoContext.Security.CurrentUser));
}
else if (url.StartsWith("#err-"))
{
// route error, report