I’m trying to create a input request validator and...
# ktor
d
I’m trying to create a input request validator and I’ve set a ConfigureExceptions() plugin:
Copy code
fun Application.configureExceptions() {
    install(StatusPages) {
        exception<Throwable> { call, cause ->
            if(cause is UnprocessableEntityException) {
                call.respondText(text = "422: $cause", status = HttpStatusCode.UnprocessableEntity)
            } else {
                call.respondText(text = "500: $cause", status = HttpStatusCode.InternalServerError)
            }
        }
    }
}
I know it works out of the box like :
class UnprocessableEntityException(override val message: String?) : Throwable()
but I’d need the message type to be :
class UnprocessableEntityException(override val message: Map<String, MutableList<String>>) : Throwable()
How can I do that ?