Skip to content

Instantly share code, notes, and snippets.

@imeredith
Created July 13, 2012 00:14
Show Gist options
  • Save imeredith/3101991 to your computer and use it in GitHub Desktop.
Save imeredith/3101991 to your computer and use it in GitHub Desktop.
val validTask = (json \ "taskId").asOpt[String] match {
case Some(taskId) if taskId.contains("UNUSED_") => new Exception("Ignoring %s, its unused event and not supposed to be billed.").fail[String]
case Some(taskId) if !taskId.isEmpty => taskId.success[Throwable]
case _ => new Exception("taskId does not exist").fail[String]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment