New tests.
[mono.git] / mcs / class / System.Web.Mvc2 / System.Web.Mvc / ModelError.cs
1 /* ****************************************************************************\r
2  *\r
3  * Copyright (c) Microsoft Corporation. All rights reserved.\r
4  *\r
5  * This software is subject to the Microsoft Public License (Ms-PL). \r
6  * A copy of the license can be found in the license.htm file included \r
7  * in this distribution.\r
8  *\r
9  * You must not remove this notice, or any other, from this software.\r
10  *\r
11  * ***************************************************************************/\r
12 \r
13 namespace System.Web.Mvc {\r
14     using System;\r
15 \r
16     [Serializable]\r
17     public class ModelError {\r
18 \r
19         public ModelError(Exception exception)\r
20             : this(exception, null /* errorMessage */) {\r
21         }\r
22 \r
23         public ModelError(Exception exception, string errorMessage)\r
24             : this(errorMessage) {\r
25             if (exception == null) {\r
26                 throw new ArgumentNullException("exception");\r
27             }\r
28 \r
29             Exception = exception;\r
30         }\r
31 \r
32         public ModelError(string errorMessage) {\r
33             ErrorMessage = errorMessage ?? String.Empty;\r
34         }\r
35 \r
36         public Exception Exception {\r
37             get;\r
38             private set;\r
39         }\r
40 \r
41         public string ErrorMessage {\r
42             get;\r
43             private set;\r
44         }\r
45     }\r
46 }\r