Merge pull request #2041 from blueboxes/dev-v7
U4-10143 - Improved error messages when we retrieve current xml node
This commit is contained in:
@@ -1393,15 +1393,25 @@ namespace umbraco
|
||||
/// <returns>An XpathNodeIterator containing the current page as Xml.</returns>
|
||||
public static XPathNodeIterator GetXmlNodeCurrent()
|
||||
{
|
||||
var pageId = "";
|
||||
|
||||
try
|
||||
{
|
||||
var nav = Umbraco.Web.UmbracoContext.Current.ContentCache.GetXPathNavigator();
|
||||
nav.MoveToId(HttpContext.Current.Items["pageID"].ToString());
|
||||
var pageIdItem = HttpContext.Current.Items["pageID"];
|
||||
|
||||
if (pageIdItem == null)
|
||||
{
|
||||
throw new NullReferenceException("pageID not found in the current HTTP context");
|
||||
}
|
||||
|
||||
pageId = pageIdItem.ToString();
|
||||
nav.MoveToId(pageId);
|
||||
return nav.Select(".");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error<library>("Could not retrieve current xml node", ex);
|
||||
LogHelper.Error<library>(string.Concat("Could not retrieve current xml node for page Id ",pageId), ex);
|
||||
}
|
||||
|
||||
XmlDocument xd = new XmlDocument();
|
||||
|
||||
Reference in New Issue
Block a user