All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.dev.programadorthi.routing.statuspages.StatusPagesJvm.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0-alpha02
Show newest version
/*
 * 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