Merge pull request #249 from pcc/xgetinputfocus
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / ExceptionContext.cs
1 namespace System.Web.Mvc {
2     using System;
3     using System.Diagnostics.CodeAnalysis;
4
5     public class ExceptionContext : ControllerContext {
6
7         private ActionResult _result;
8
9         // parameterless constructor used for mocking
10         public ExceptionContext() {
11         }
12
13         [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "The virtual property setters are only to support mocking frameworks, in which case this constructor shouldn't be called anyway.")]
14         public ExceptionContext(ControllerContext controllerContext, Exception exception)
15             : base(controllerContext) {
16             if (exception == null) {
17                 throw new ArgumentNullException("exception");
18             }
19
20             Exception = exception;
21         }
22
23         public virtual Exception Exception {
24             get;
25             set;
26         }
27
28         public bool ExceptionHandled {
29             get;
30             set;
31         }
32
33         public ActionResult Result {
34             get {
35                 return _result ?? EmptyResult.Instance;
36             }
37             set {
38                 _result = value;
39             }
40         }
41
42     }
43 }