changes to PanicException

This commit is contained in:
Shannon
2019-08-16 16:18:58 +10:00
parent bbd6e1150e
commit e9717ee86a
3 changed files with 8 additions and 7 deletions

View File

@@ -796,7 +796,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
if (_contentNodes.TryGetValue(id, out var link) && link.Value != null)
return link;
throw new PanicException($"panic: failed to get {description} with id={id}");
throw new PanicException($"failed to get {description} with id={id}");
}
private LinkedNode<ContentNode> GetParentLink(ContentNode content)
@@ -827,7 +827,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
// must have children
if (parent.FirstChildContentId < 0)
throw new Exception("panic: no children");
throw new PanicException("no children");
// if first, clone parent + remove first child
if (parent.FirstChildContentId == content.Id)

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Exceptions;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Composing;
using Umbraco.Web.Models;
@@ -119,7 +120,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
case PublishedItemType.Media:
return GetMediaByIdFunc;
default:
throw new Exception("panic: invalid item type");
throw new PanicException("invalid item type");
}
}
@@ -194,7 +195,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
};
if (ContentData.CultureInfos == null)
throw new Exception("panic: _contentDate.CultureInfos is null.");
throw new PanicException("_contentDate.CultureInfos is null.");
return _cultures = ContentData.CultureInfos
.ToDictionary(x => x.Key, x => new PublishedCultureInfo(x.Key, x.Value.Name, x.Value.UrlSegment, x.Value.Date), StringComparer.OrdinalIgnoreCase);
@@ -286,13 +287,13 @@ namespace Umbraco.Web.PublishedCache.NuCache
{
// but if IsPreviewing is true, we should have a child
if (IsPreviewing)
throw new Exception($"panic: failed to get content with id={id}");
throw new PanicException($"failed to get content with id={id}");
// if IsPreviewing is false, get the unpublished child nevertheless
// we need it to keep enumerating children! but we don't return it
content = getById(publishedSnapshot, true, id);
if (content == null)
throw new Exception($"panic: failed to get content with id={id}");
throw new PanicException($"failed to get content with id={id}");
}
id = UnwrapIPublishedContent(content)._contentNode.NextSiblingContentId;