add new issue       

Issue ID:  796     BusinessRules: Identifying which rule threw an exception      
Created by PeranB on 2010-07-09 8:26 AM, 2695 days ago
Project:  CSLA .NET
Category:  enhancement
Priority:  med
Status:  closed
Feature area:Validation
Version:4.0.x
  Entering "issue#999" in comment creates link to id 999

show inline images      show change history

comment 2699 posted by PeranB on 2010-07-09 8:50 AM, 2695 days ago 
File patched
comment 2697 posted by PeranB on 2010-07-09 8:26 AM, 2695 days ago 
If I have 10 rules attached to a property, and 1 throws an exception,
the error result gives no indication of which rule I should focus my
attention.  The proposed patch adds the rule uri to the error message,
if I remember correctly csla 3.x provided this infomation.
Index: BusinessRules.cs
===================================================================
--- BusinessRules.cs    (revision 4854)
+++ BusinessRules.cs    (working copy)
@@ -544,7 +544,7 @@
         }
         catch (Exception ex)
         {
-          context.AddErrorResult(ex.Message);
+          context.AddErrorResult(string.Format("{0}:{1}",
rule.RuleName, ex.Message));
           if (rule.IsAsync)
             context.Complete();
         }