Guest User

Untitled

a guest
Jan 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. def leaderboardPost(name: Option[String]): Route =
  2. post {
  3. logRequest("leaderboard", Logging.DebugLevel) {
  4. handleRejections(postBodyRejections) {
  5. entity(as[LeaderboardPostRequest]) { leaderboard =>
  6. try {
  7. complete(leaderboardCreate(Some(leaderboard.name), Some(leaderboard.kind)))
  8. } catch {
  9. case cause: DuplicateIDException =>
  10. logger.error(cause)
  11. complete(cause.response)
  12. case cause: UnknownKindException =>
  13. logger.warn(cause)
  14. complete(cause.response)
  15. case cause: Throwable =>
  16. logger.error(cause)
  17. complete(HttpResponse(InternalServerError, entity = s"Exception thrown from LeaderboardPost: ${cause.getMessage}"))
  18. }
  19. }
  20. }
  21. }
  22. }
Add Comment
Please, Sign In to add comment