ProblemDetailsCatalog

A declarative catalog of exception-to-problem and status-to-problem mappings.

Every entry becomes exactly one registration on Ktor's own StatusPages configuration; dispatch, including nearest-parent-class resolution, stays StatusPages's job. Obtain one through problemDetails.

Functions

Link copied to clipboard

Registers a problem body for one status code.

Link copied to clipboard
inline fun <T : Throwable> map(noinline toProblem: (ApplicationCall, T) -> Problem)

Maps T to a problem built from the call and the exception.

inline fun <T : Throwable> map(type: ProblemType, noinline detailFrom: (T) -> String? = { it.message })

Maps T to type, taking detail from the exception message by default.

Link copied to clipboard

Replaces the problem produced for an exception no mapping covers.

Link copied to clipboard

Covers the codes Ktor itself generates without an explicit body: 404, 405, 406, 415.