1 // Copyright 2004-2007 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 TestSiteNVelocity
.Controllers
19 using Castle
.MonoRail
.Framework
;
22 public abstract class BaseController
: SmartDispatcherController
27 [Rescue("updateerror", typeof(ApplicationException
))]
28 [ControllerDetails("rescuable2")]
29 public class RescueExtendedController
: BaseController
33 throw new Exception();
38 throw new ApplicationException();
43 [ControllerDetails("rescuable")]
44 public class RescueController
: SmartDispatcherController
48 throw new ApplicationException();
52 public void MethodWithSkipRescue()
54 throw new ApplicationException();
60 throw new ApplicationException();
63 [Rescue("updateerror")]
66 LayoutName
= "master";
68 throw new ApplicationException();
71 [Rescue("updateerrormsg")]
72 public void UpdateMsg()
74 throw new ApplicationException("custom msg");
77 [Rescue("appException",typeof(ApplicationException
))]
78 [Rescue("argException",typeof(ArgumentException
))]
79 public void RescueWithExceptionsByType(String exceptionType
)
81 if( exceptionType
== "appException" )
82 throw new ApplicationException("appException");
84 if( exceptionType
== "argException" )
85 throw new ArgumentException("argException");
87 throw new Exception();
90 [Rescue("methodDefaultException")]
91 [Rescue("appException",typeof(ApplicationException
))]
92 [Rescue("argException",typeof(ArgumentException
))]
93 public void RescueWithExceptionsByTypeWithDefaultException(string exceptionType
)
95 if( exceptionType
== "appException" )
96 throw new ApplicationException("appException");
98 if( exceptionType
== "argException" )
99 throw new ArgumentException("argException");
101 throw new Exception();
104 [AccessibleThrough(Verb
.Post
)]
105 public void OnlyPost()