Skip to content

Instantly share code, notes, and snippets.

@dohzya
Last active December 11, 2015 11:48
Show Gist options
  • Save dohzya/4595951 to your computer and use it in GitHub Desktop.
Save dohzya/4595951 to your computer and use it in GitHub Desktop.
Exemple of request that silently fail in Play 2.1
package controllers
import play.api._
import play.api.mvc._
object Die {
def potato = "not today"
val iLikeTrain = ???
}
object Application extends Controller {
def index = Action {
Die.potato // Nooooooooo !
Ok(views.html.index("Your new application is ready."))
}
}

The ??? method returns a MethodUndefinedException error, so the Die object can't be initialized. But the initialization seems to be lazy.

When the index action try to call Die.potato, the object is initialized, fails, and then an error is thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment