problemDetails
Registers a ProblemDetailsCatalog against Ktor's own StatusPages configuration.
Each catalog entry becomes one exception(...)/status(...) registration and nothing more: the library generates the calls a developer would otherwise hand-write, so dispatch stays Ktor's.
Samples
install(ContentNegotiation) { problemJson() }
install(StatusPages) {
problemDetails {
// 404, 405 and the rest of Ktor's own status responses become problem documents.
standardStatusCodes()
map<OrderNotFound> { _, cause ->
problem {
type = "https://example.com/probs/order-not-found"
status = 404
title = "Order not found."
detail = "No order ${cause.id} exists."
}
}
// Anything not mapped above, including exceptions thrown by other plugins.
onUnmapped { _, _ ->
problem {
status = 500
title = "Internal Server Error"
}
}
}
}Content copied to clipboard