neworldlt
application/json
text/html
text/plain
gildor
cy
install(ContentNegotiation) { gson { setPrettyPrinting() } } install(StatusPages) { exception<FileNotFoundException> { t -> call.respond(...) } }
install(ContentNegotiation) { val converter = JacksonConverter(objectMapper) register(ContentType.Application.Json, converter) } install(StatusPages) { exception<BackendException> { cause -> call.respond(cause.responseStatus, cause.errorResponse) } exception<ValidationException> { cause -> call.respond(HttpStatusCode.InternalServerError, ErrorResponse(OTHER, message = cause.localizedMessage)) } }
ErrorResponse()
OK
ContentNegotiation
StatusPages
A modern programming language that makes developers happier.