- Notifications
You must be signed in to change notification settings - Fork 3
Status pages
Thiago Santos edited this page Aug 14, 2024 · 1 revision
The StatusPages plugin allows your application appropriately handle any failure state based on a thrown exception.
sourceSets { commonMain.dependencies { implementation("dev.programadorthi.routing:status-pages:$version") } }
The exception handler allows you to handle calls that result in a Throwable exception:
val router = routing { install(StatusPages) { exception<Throwable> { call, cause -> if (cause is AuthorizationException) { call.redirectToPath(path = "/login") } else { // ... } } } }