Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #8 from CatTail/chore/error-message
Browse files Browse the repository at this point in the history
return detailed error message than BackpressureTimeout
  • Loading branch information
aserrallerios authored Sep 4, 2018
2 parents e5ad806 + d2cde96 commit cbc8ae4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/main/scala/aserralle/akka/stream/kcl/Errors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

package aserralle.akka.stream.kcl

import scala.util.control.NoStackTrace

object Errors {
sealed class KinesisWorkerSourceError(err: Throwable) extends Throwable(err)

sealed trait KinesisWorkerSourceError extends NoStackTrace
case class WorkerUnexpectedShutdown(cause: Throwable)
extends KinesisWorkerSourceError

case object BackpressureTimeout extends KinesisWorkerSourceError
extends KinesisWorkerSourceError(cause)

case class BackpressureTimeout(cause: Throwable)
extends KinesisWorkerSourceError(cause)
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object KinesisWorkerSource {
(Exception.nonFatalCatch either Await.result(
queue.offer(record),
settings.backpressureTimeout) left)
.foreach(_ => queue.fail(BackpressureTimeout))
.foreach(err => queue.fail(BackpressureTimeout(err)))
semaphore.release()
},
settings.terminateStreamGracePeriod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ class KinesisWorkerSourceSourceSpec

Await.ready(watch, 5.seconds)
val Failure(exception) = watch.value.get
assert(exception == BackpressureTimeout)
assert(
exception.getCause.getMessage
.contains("Futures timed out after [100 milliseconds]"))

killSwitch.shutdown()
}
Expand Down

0 comments on commit cbc8ae4

Please sign in to comment.