From 779670e70d112262c1dd239942d8da0802c5d700 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 27 Aug 2013 17:20:31 +0000 Subject: [PATCH] Added logic to handle errors if the Range location cannot be found from the To location. This corrects range type transitions (AND type) which extend to the last sibling of the To location. --- .../Extension/TransitionExt.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index e8ffda76..2b16bc08 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -33,7 +33,17 @@ namespace VEPROMS.CSLA.Library } public string ResolvePathTo(FormatInfo fi, ItemInfo itminfo, int tranType, ItemInfo toitem, ItemInfo rangeitem) { - return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem); + try + { + return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, rangeitem); + } + catch (Exception ex) + { + if (tranType == 2 && ex.Message == "Cannot find Next Item") + return TransitionText.GetResolvedText(fi, itminfo, tranType, toitem, toitem); + _MyLog.Error("Error Processing Transition Text", ex); + return "(Resolved Transition Text)"; + } } public string ResolvePathTo() { @@ -788,7 +798,10 @@ namespace VEPROMS.CSLA.Library if (rangeAncestors.ContainsKey(next.ItemID)) return rangeAncestors[next.ItemID]; while (next.NextItem == null) + { next = next.ActiveParent as ItemInfo; + if(next == null) throw(new Exception("Cannot find Next Item")); + } return next.NextItem; } private static bool AddOptionalTranGetSectionHdr(TransitionBuilder tb)