ExceptionHandler.kt

  1. package com.hexagontk.http.handlers

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

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

  11.     override val handlerPredicate: HttpPredicate = HttpPredicate()

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