which method of working with failed states in rout...
# ktor
e
which method of working with failed states in routes more idiomatic? 1.Similar to call.respondRedirect()
Copy code
val id = query["id"] ?: return@post call.respondBadRequest()
2. Using exceptions and StatusPage
Copy code
val id = query["id"]  ?: throw BadRequestException()
c
I've been using
val id = query["id"] ?: error("...")
but I have no idea how idiomatic it is.
a
I would say that the second option is more idiomatic and succinct.