Re: [play-framework] Handling Database unavailability

20 views
Skip to first unread message

Will Sargent

unread,
Jun 30, 2016, 2:30:05 PM6/30/16
to play-fr...@googlegroups.com
The best way to do it is to keep your controller logic and your database logic distinct, and then use Action.async and a Future / recover block to pick back up from the time out exception.

See https://github.com/playframework/play-isolated-slick/blob/master/modules/play/app/controllers/HomeController.scala -- where the .map is, you want to add a .recover call with a case that will return a Result with a different view.

Will.

On Thu, Jun 30, 2016 at 4:06 AM, Pall Grey <pch...@gmail.com> wrote:
Hello.

I'm using play 2.4.4 and want to implement a handler to show a certain page in case of any of my database connections are timed out or unavailable. For now it throws NPE on DB worker classes.

Is there any known way to do this?

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/e85e4ef6-d442-40c3-8f22-30842e62297c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages