On Sat, Dec 20, 2008 at 11:20 PM, Marius <[email protected]> wrote:
> > You already got good advices to your particular problem still an > exception thrown from LoanWrapper-s should be caught by and your > function called. I'll look into it tomorrow. Actually, it should not. The loan wrappers execute outside of the HTML rendering pipeline. They are not part of the logic of this pipeline and thus should not have their exceptions handled by the standard HTML pipeline. The fact that the exception got propagated to the container is the correct behavior in Lift. If you're doing stuff with Loan Wrappers, it's your responsibility to not disturb the return value that your wrapper is around. In this case, the Response has already been generated. It should be allowed to be sent to the user. Thanks, David > > > > Br's, > Marius > > On 18 Dec, 23:58, Oliver <[email protected]> wrote: > > I was redirecting to an error page using > > LiftRules.logAndReturnExceptionToBrowser, but when I use a LoanWrapper > > to close a EntityManager and an error occurs when closing the entity > > manager, LiftRules.logAndReturnExceptionToBrowser doesn't appear to > > redirect to my error page. Can anyone think of a work around? > > > > // Output a simple error to the user. Link the error message > > to the screen via the current datetime > > LiftRules.logAndReturnExceptionToBrowser = { > > RedirectResponse("/error); > > } > > > > // Set up a LoanWrapper to automatically close a EntityManager > > if its open > > S.addAround(List( > > new LoanWrapper { > > def apply[T] (f : => T): T = { > > try { > > f > > } finally { > > EM.closeEM // close if open > > } > > } > > })) > > > > } > > > -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" 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/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
