Minor style changes
[castle.git] / MonoRail / TestSiteNVelocity / Controllers / RescueController.cs
bloba3ecc8536cb5ee7fa28748028a41cf93b8d6ea2b
1 // Copyright 2004-2007 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 TestSiteNVelocity.Controllers
17 using System;
19 using Castle.MonoRail.Framework;
21 [Rescue("general")]
22 public abstract class BaseController : SmartDispatcherController
26 [Rescue("saveerror")]
27 [Rescue("updateerror", typeof(ApplicationException))]
28 [ControllerDetails("rescuable2")]
29 public class RescueExtendedController : BaseController
31 public void Save()
33 throw new Exception();
36 public void Save2()
38 throw new ApplicationException();
42 [Rescue("general")]
43 [ControllerDetails("rescuable")]
44 public class RescueController : SmartDispatcherController
46 public void Index()
48 throw new ApplicationException();
51 [SkipRescue]
52 public void MethodWithSkipRescue()
54 throw new ApplicationException();
57 [Rescue("saveerror")]
58 public void Save()
60 throw new ApplicationException();
63 [Rescue("updateerror")]
64 public void Update()
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()