Skip to content

Instantly share code, notes, and snippets.

@dsugden
Last active December 11, 2015 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsugden/4582859 to your computer and use it in GitHub Desktop.
Save dsugden/4582859 to your computer and use it in GitHub Desktop.
Example of JSON Read[A] and Try[A]
Articles.update(valid) match {
case Success(a) => {
cache.Cache.remove("blog")
Ok(Json.toJson(ArticleId(valid.id)))
}
case Failure(e) => {
Logger.error("update error:", e)
BadRequest(Json.toJson(Map("error" -> e.getMessage())))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment