jvmMain.dev.programadorthi.routing.statuspages.StatusPagesJvm.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of status-pages-jvm Show documentation
Show all versions of status-pages-jvm Show documentation
A basic port to https://ktor.io/docs/server-status-pages.html
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package dev.programadorthi.routing.statuspages
import dev.programadorthi.routing.core.application.ApplicationCall
import io.ktor.util.pipeline.PipelineContext
/**
* Register an exception [handler] for the exception class [klass] and its children
*/
public fun StatusPagesConfig.exception(
klass: Class,
handler: suspend PipelineContext.(T) -> Unit,
) {
@Suppress("UNCHECKED_CAST")
val cast = handler as suspend (ApplicationCall, Throwable) -> Unit
exceptions[klass.kotlin] = cast
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy