Skip to content

Instantly share code, notes, and snippets.

@tpanagos
Last active August 29, 2015 14:09
Show Gist options
  • Save tpanagos/8daebc0a555a05c835a3 to your computer and use it in GitHub Desktop.
Save tpanagos/8daebc0a555a05c835a3 to your computer and use it in GitHub Desktop.
try {
//dangerous java calls
}
catch {
//Gracefully catch any exceptions that might generate from the Java call or the JSON handling.
case e: Exception => {
status = "FAIL"
err_msg = "Err: " + e.getMessage + " Cause: " + e.getCause
//anything else
}
}
val paramMap: JsObject = (Try(parameterMap.getValue(execution).asInstanceOf[JsObject]) match {
case Success(myObj: JsObject) => {
myObj
}
case Failure(myException) => {
foo
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment