On Thu, May 7, 2009 at 9:55 AM, ivan <ivan.se...@gmail.com> wrote:
Ivan,


>
>
> On May 7, 6:02 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> > On Thu, May 7, 2009 at 7:19 AM, ivan <ivan.se...@gmail.com> wrote:
> >
> > > Hi people. Time has come for my second question on this group :)
> >
> > Please keep asking questions...
>
> Thanks for responding so fast.
>
> > although when you become skilled enough with
> > Lift, I hope that you'll answer some as well.
>
> I sure will. I'm thinking of a JSF->Lift transition guide. But I'm
> still working on the transitioning part.


Would love to see that!


>
>
> > > The link works fine, the entity is deleted from the database and
> > > "Succesfully deleted!" notice is shown but an exception happens in the
> > > finally block when calling S.redirectTo(dest).
> >
> > This should work.  Please post the complete stack trace that you're
> getting.
>
> Here is the complete stack trace (I hope it will help):
>
> net.liftweb.http.ResponseShortcutException:
> Shortcut
>        at net.liftweb.http.ResponseShortcutException$.redirect
> (ResponseShortcutException.scala:
> 31)
>        at net.liftweb.http.S$.redirectTo(S.scala:
> 322)
>        at hr.ivan.util.PageUtil$$anonfun$deleteLink$1.apply
> (PageUtil.scala:
> 58)
>        at net.liftweb.http.SHtml$$anonfun$link$1.apply(SHtml.scala:
> 243)
>        at net.liftweb.http.SHtml$$anonfun$link$1.apply(SHtml.scala:
> 243)
>        at net.liftweb.http.S$LFuncHolder.apply(S.scala:
> 961)
>        at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply
> (LiftSession.scala:
> 328)
>        at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply
> $18.apply(LiftSession.scala:
> 343)
>        at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply
> $18.apply(LiftSession.scala:
> 343)
>        at scala.List.map(List.scala:
> 812)
>        at net.liftweb.http.LiftSession$$anonfun$6.apply
> (LiftSession.scala:
> 343)
>        at net.liftweb.http.LiftSession$$anonfun$6.apply
> (LiftSession.scala:
> 332)


Okay... Lift is processing the request at the right place.


>
> >
> > S.redirectTo does throw an exception that is supposed to be caught by the
> > Lift rendering machinery and then turned into a Redirect.  I'm interested
> in
> > seeing why the machinery is not catching the exception.
>
> I already pasted the stack trace and then realized... Lift isn't
> catching the exception because I'am.
> I am doing a: case e : Throwable =>
>                         logAndError("Some strange exception happened",
>

Try something like:

case e: Throwable if
!e.instanceOf[net.liftweb.http.ResponseShortcutException] =>
logAndError(...)

That way you will not catch the ResponseShortcutException


>
> That is why i'a seeing a stack trace and an error message. Is that
> supposed to work that way?


Yes, if you catch exceptions and display them, then they will be displayed.
:-)  Lift uses the exception mechanism sparingly, but in the case of
redirects, it seems to be the best mechanism.


>
>
> >
> > > The idea is to enable user to provide a callback (in the finally part)
> > > to determine to what page to redirect after deleting an entity (maybe
> > > as a function of weather deletion was successful) and this is only a
> > > prototype but it doesn't work for some reason.
> >
> > > Any idea what could be causing this? I have SHtml.links in other
> > > simpler places that have redirectTo and there it works.
> >
> > > Thanks in advance :)
> >
> > > PS I really love lift, it is really a refreshing framework.
> >
> > I like the tag line... Lift, the refereshing framework... kinda makes me
> > think of having a beer... oh wait, it's 9am... never mind.
> >
>
> Mmmmm :)
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
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