1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
18 using System
.Runtime
.Serialization
;
21 /// Base exception for monorail exceptions
24 public class MonoRailException
: ApplicationException
26 private int? httpStatusCode
;
27 private string httpStatusDesc
;
30 /// Initializes a new instance of the <see cref="MonoRailException"/> class.
32 /// <param name="message">The message.</param>
33 public MonoRailException(string message
) : base(message
)
38 /// Initializes a new instance of the <see cref="MonoRailException"/> class.
40 /// <param name="httpStatusCode">The HTTP status code.</param>
41 /// <param name="httpStatusDesc">The HTTP status desc.</param>
42 /// <param name="message">The message.</param>
43 public MonoRailException(int httpStatusCode
, string httpStatusDesc
, string message
)
46 this.httpStatusCode
= httpStatusCode
;
47 this.httpStatusDesc
= httpStatusDesc
;
51 /// Initializes a new instance of the <see cref="MonoRailException"/> class.
53 /// <param name="message">The message.</param>
54 /// <param name="args">The args.</param>
55 public MonoRailException(String message
, params object[] args
) : this(String
.Format(message
, args
))
60 /// Initializes a new instance of the <see cref="MonoRailException"/> class.
62 /// <param name="message">The message.</param>
63 /// <param name="innerException">The inner exception.</param>
64 public MonoRailException(String message
, Exception innerException
) : base(message
, innerException
)
69 /// Initializes a new instance of the <see cref="MonoRailException"/> class.
71 /// <param name="info">The object that holds the serialized object data.</param>
72 /// <param name="context">The contextual information about the source or destination.</param>
73 public MonoRailException(SerializationInfo info
, StreamingContext context
) : base(info
, context
)
78 /// Gets the HTTP status code.
80 /// <value>The HTTP status code.</value>
81 public int? HttpStatusCode
83 get { return httpStatusCode; }
87 /// Gets the HTTP status description.
89 /// <value>The HTTP status description.</value>
90 public string HttpStatusDesc
92 get { return httpStatusDesc; }