raulraja
11/13/2017, 2:30 PMmongoClient.runCommand is also async by nature and catches it's own exceptions, do you actually need coroutines here at all?
fun health(mongo: MongoClient): (RoutingContext) -> Unit = { ctx ->
mongoClient.runCommand("ping", json { obj("ping" to 1) }, {
if (it.succeeded())
ctx.response().endWithJson(result)
else {
val errorObj = json { obj("error" to it.cause().message) }
ctx.response().statusCode = 500
ctx.response().endWithJson(errorObj)
}
}
}