I'd put a try/finally around the EM.closeEM call so that it does not impact
the stuff that's being rendered to the browser.  Don't let the exception in
the finally block propogate.

On Thu, Dec 18, 2008 at 1:58 PM, Oliver <ola...@gmail.com> 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 liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to