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

eventstore.operations.ReadStreamEventsInspection.scala Maven / Gradle / Ivy

The newest version!
package eventstore
package operations

import ReadStreamEventsError._
import Inspection.Decision.Fail

private[eventstore] case class ReadStreamEventsInspection(out: ReadStreamEvents)
    extends ErrorInspection[ReadStreamEventsCompleted, ReadStreamEventsError] {

  def decision(error: ReadStreamEventsError) = {
    val result = error match {
      case StreamNotFound => StreamNotFoundException(streamId)
      case StreamDeleted  => new StreamDeletedException(s"Read failed due to $streamId has been deleted")
      case Error(error)   => new ServerErrorException(error.orNull)
      case AccessDenied   => new AccessDeniedException(s"Read access denied for $streamId")
    }

    Fail(result)
  }

  def streamId = out.streamId
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy