Ah, so it seems, once you define a method in the rescue attribute, the Rescue(...) is not called anymore. Seems by design, I just wonder if this is was one would expect - I certainly did not.
2009/6/24 Jan Limpens <[email protected]> > Debugging shows, my Json() method is called on the rescue, but never the > Rescue(...) method. > > Watching the friendly log I get... > 2009-06-24 11:50:07,944 [9] FATAL Fex.Web.Site.MVC.Controllers.TestRescues > - Failed to process rescue view. View name > Castle.MonoRail.Framework.MonoRailException: Exception on process view: > rescues\generic > Last accessed variable: rescueUrl ---> > Castle.MonoRail.Framework.MonoRailException: Parameter 'rescueUrl' was not > found! > > Okidoki! Makes perfect sense! As my Rescue(...) is never called this value > is also unitialized. > > Now, what could be the reason that Rescue() isn't called? > > --Jan > > 2009/6/23 Jan Limpens <[email protected]> > > yeah, but it seems the jsonreturnbinder attribute misleads things... >> >> 2009/6/23 Ken Egozi <[email protected]> >> >> does BaseController inherit SmartDispatcherController >>> >>> >>> On Tue, Jun 23, 2009 at 8:51 PM, Jan Limpens <[email protected]>wrote: >>> >>>> Hello, >>>> >>>> I am trying to make use of custom rescues, but so far, I am not really >>>> getting anywhere. >>>> >>>> On my controller I have: >>>> >>>> [Rescue(typeof(RescuesController), "Json")] >>>> [return: JSONReturnBinder] >>>> public object JsonException() >>>> { >>>> throw new Exception("hello, bad world!"); >>>> } >>>> >>>> which should fire this: >>>> >>>> public class RescuesController : BaseController, IRescueController >>>> { >>>> private Exception _exception; >>>> >>>> [return: JSONReturnBinder] >>>> public ViewDataBase Json() >>>> { >>>> return new ViewDataBase(ActionResult.Failure, >>>> _exception.Message, null); >>>> } >>>> >>>> public void Rescue(Exception exception, IController controller, >>>> IControllerContext controllerContext) >>>> { >>>> _exception = exception; >>>> } >>>> } >>>> >>>> >>>> but instead I am getting just ye olde yellow screen with the thrown >>>> exception. Nothing indicates that it would fail on getting the rescue to >>>> run... >>>> >>>> What am I doing wrong? >>>> >>>> -- >>>> Jan >>>> >>>> >>>> >>> >>> >>> -- >>> Ken Egozi. >>> http://www.kenegozi.com/blog >>> http://www.delver.com >>> http://www.musicglue.com >>> http://www.castleproject.org >>> http://www.gotfriends.co.il >>> >>> >>> >>> >> >> >> -- >> Jan >> > > > > -- > Jan > -- Jan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
