How to make error handlers in Lift? I have html page with some snippets, if one of those snippets throws an exception I want to catch it and redirect to some user friendly error page.
How to do this in catch-all manner? I do not want to put error handling to each snippet separately. I am looking something like this in Wicket.
When in doubt, check LiftRules API.
According this post something like this should work:
LiftRules.exceptionHandler.prepend {
case ("production", Req(path, "", GetRequest), someException) => {
Log.error("MELT DOWN!!")
RedirectResponse("/")
}
}
The signature of the exception handler type is:
type ExceptionHandlerPF = PartialFunction[(Props.RunModes.Value, Req,
Throwable), LiftResponse]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With