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

com.twitter.finagle.http.util.FailingWriter.scala Maven / Gradle / Ivy

package com.twitter.finagle.http.util

import com.twitter.finagle.http.Chunk
import com.twitter.io.{StreamTermination, Writer}
import com.twitter.util.{Future, Time}

/**
 * A [[Writer]] whose each operation fails with [[UnsupportedOperationException]].
 */
private[finagle] object FailingWriter extends Writer[Chunk] {
  def fail(cause: Throwable): Unit = ()

  def write(element: Chunk): Future[Unit] =
    Future.exception(new UnsupportedOperationException("FailingWriter"))

  def close(deadline: Time): Future[Unit] =
    Future.exception(new UnsupportedOperationException("FailingWriter"))

  def onClose: Future[StreamTermination] =
    Future.exception(new UnsupportedOperationException("FailingWriter"))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy