If you want a popup a dialog when an exception is thrown from an Ajax
function you can do something like:

import net.liftweb.http.js._
import net.liftweb.http.js.jquery._
import JqJsCmds._
...

LiftRules.exceptionHandler.prepend {
      case (mode, req, ex) => JavaScriptResponse(ModalDialog(<p>Crap
it failed.</p>))
}

You can make you own logic to distinguish between exceptions thrown
from Ajax requests or from snippet, either by some information from
Req or some additional information from the exception itself or by
some other means.

Br's,
Marius

On Dec 24, 11:15 am, Xuefeng Wu <ben...@gmail.com> wrote:
> Hi,
> I have a question about exception handle in Lift.
>
> *How could I pop a error dialog except redirect?*
> *
> *
> *Lift have LiftRules.exceptionHandler.prepend to handle exception.*
> LiftRules.exceptionHandler.prepend {
>       case (mode, state, ex) => RedirectResponse("/error")
>       // how could I pop a error dialog?
>  }
>
> And I found that Lift could handle exception from snippet , for example:
>   def throwExceptionB(in: NodeSeq): NodeSeq = {
>     throw new RuntimeException("throw exception")
>     a(() => {Alert("Text throw exception")},
>              Text("throw exception")
>     )
>   }
>
> But I find lift didn't throw exception if it rise from lift inside:
>    def throwExceptionB(in: NodeSeq): NodeSeq = {
>     a(() => {throw new RuntimeException("throw exception");Alert("Test throw
> exception")},
>              Text("throw exception")
>     )
>    }
> The exception will be printed at server side but not the client.
> I think Lift should also could handle it.
>
> --
> Scala中文社区:  http://groups.google.com/group/scalacn

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@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