dany giguere
02/22/2022, 8:56 PMfun 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 ?