Permalink
Browse files

override ToString to show cause of error neatly in VS's Exception dialog

  • Loading branch information...
1 parent e2479eb commit b2a545cfb88bb572680e86f63aeb14a85ed4782f @timiles timiles committed May 10, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 Harden/HardenInterceptor.cs
@@ -65,6 +65,14 @@ public Error(string message)
public string Message { get; private set; }
- public string Field { get; internal set; }
+ public string Field { get; internal set; }
+
+
+ public override string ToString()
+ {
+ return !string.IsNullOrWhiteSpace(Field)
+ ? string.Format("Field: {0}; Message: {1}", Field, Message)
+ : "Message: " + Message;
+ }
}
}

0 comments on commit b2a545c

Please sign in to comment.