Last active
December 11, 2015 09:49
-
-
Save dsugden/4582859 to your computer and use it in GitHub Desktop.
Example of JSON Read[A] and Try[A]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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