ExceptionHandler.kt

  1. package com.hexagonkt.http.handlers

  2. import com.hexagonkt.handlers.ExceptionHandler
  3. import com.hexagonkt.handlers.Handler
  4. import com.hexagonkt.http.model.HttpCall
  5. import kotlin.reflect.KClass

  6. data class ExceptionHandler<E : Exception>(
  7.     val exception: KClass<E>,
  8.     val clear: Boolean = true,
  9.     val block: HttpExceptionCallbackType<E>
  10. ) : HttpHandler, Handler<HttpCall> by ExceptionHandler(exception, clear, toCallback(block)) {

  11.     override val handlerPredicate: HttpPredicate = HttpPredicate()

  12.     override fun addPrefix(prefix: String): HttpHandler =
  13.         this
  14. }