From 5eb20a11014be1787e13098bc06909299df62c77 Mon Sep 17 00:00:00 2001 From: hartvig Date: Tue, 22 Feb 2011 13:53:56 -0100 Subject: [PATCH] Better error reporting inside the NiceUrl engine --- umbraco/presentation/library.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/umbraco/presentation/library.cs b/umbraco/presentation/library.cs index 2e6c238352..841b3a66ff 100644 --- a/umbraco/presentation/library.cs +++ b/umbraco/presentation/library.cs @@ -425,6 +425,17 @@ namespace umbraco { string parentUrl = String.Empty; XmlElement node = UmbracoContext.Current.GetXml().GetElementById(nodeId.ToString()); + + if (node == null) + { + ArgumentException arEx = + new ArgumentException( + string.Format( + "Couldn't find any page with the nodeId = {0}. This is most likely caused by the page isn't published!", + nodeId), "nodeId"); + Log.Add(LogTypes.Error, nodeId, arEx.Message); + throw arEx; + } if (node.ParentNode.Name.ToLower() != "root" || UmbracoSettings.UseDomainPrefixes) { if (UmbracoSettings.UseDomainPrefixes)