More working tests.
[castle.git] / MonoRail / Castle.MonoRail.Framework / Descriptors / RescueDescriptor.cs
blob165da22f5a0cff598f4a16537c74266799d620ef
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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.Descriptors
17 using System;
18 using System.Reflection;
20 /// <summary>
21 /// Represents a rescue configuration
22 /// </summary>
23 public class RescueDescriptor
25 private readonly string viewName;
26 private readonly Type exceptionType;
27 private readonly Type rescueController;
28 private readonly MethodInfo rescueMethod;
30 /// <summary>
31 /// Initializes a new instance of the <see cref="RescueDescriptor"/> class.
32 /// </summary>
33 /// <param name="viewName">Name of the rescue view.</param>
34 /// <param name="exceptionType">Type of the exception it is associated with.</param>
35 public RescueDescriptor(string viewName, Type exceptionType)
37 this.viewName = viewName;
38 this.exceptionType = exceptionType;
41 /// <summary>
42 /// Initializes a new instance of the <see cref="RescueDescriptor"/> class.
43 /// </summary>
44 /// <param name="rescueController">Controller to handle the rescue</param>
45 /// <param name="rescueMethod">Method to handle the rescue</param>
46 /// <param name="exceptionType">Type of the exception it is associated with.</param>
47 public RescueDescriptor(Type rescueController, MethodInfo rescueMethod, Type exceptionType)
49 this.rescueController = rescueController;
50 this.rescueMethod = rescueMethod;
51 this.exceptionType = exceptionType;
54 /// <summary>
55 /// Gets the name of the rescue view.
56 /// </summary>
57 /// <value>The name of the view.</value>
58 public string ViewName
60 get { return viewName; }
63 /// <summary>
64 /// Gets the type of the exception this rescue is associated with.
65 /// </summary>
66 /// <value>The type of the exception.</value>
67 public Type ExceptionType
69 get { return exceptionType; }
72 /// <summary>
73 /// The controller to use for rescue
74 /// </summary>
75 public Type RescueController
77 get { return rescueController; }
80 /// <summary>
81 /// The method on the rescue controller to use
82 /// </summary>
83 public MethodInfo RescueMethod
85 get { return rescueMethod; }