Skip to content

Commit

Permalink
adjust KyoException
Browse files Browse the repository at this point in the history
  • Loading branch information
HollandDM committed Dec 17, 2024
1 parent 91ed5bd commit 79cdc47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ object StreamPublisher:
Tag[Emit[Chunk[V]]],
Tag[Poll[Chunk[V]]]
): StreamPublisher[V, Ctx] < (Resource & IO & Ctx) =
inline def interruptPanic = Result.Panic(Fiber.Interrupted(scala.compiletime.summonInline[Frame]))

def discardSubscriber(subscriber: Subscriber[? >: V]): Unit =
subscriber.onSubscribe(new Subscription:
override def request(n: Long): Unit = ()
Expand All @@ -52,7 +50,7 @@ object StreamPublisher:
for
subscription <- IO.Unsafe(new StreamSubscription[V, Ctx](stream, subscriber))
fiber <- subscription.subscribe.andThen(subscription.consume)
_ <- supervisor.onInterrupt(_ => fiber.interrupt(interruptPanic).unit)
_ <- supervisor.onInterrupt(_ => fiber.interrupt(Result.Panic(Interrupt())).unit)
yield ()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ abstract class Test extends AsyncFreeSpec with BaseKyoTest[Async & Resource] wit

def run(v: Future[Assertion] < (Async & Resource)): Future[Assertion] =
import AllowUnsafe.embrace.danger
val a = Async.run(Resource.run(v))
val b = a.map(_.toFuture).map(_.flatten)
IO.Unsafe.evalOrThrow(b)
v.pipe(
Resource.run,
Async.run,
_.map(_.toFuture).map(_.flatten),
IO.Unsafe.evalOrThrow
)
end run

type Assertion = org.scalatest.compatible.Assertion
Expand Down

0 comments on commit 79cdc47

Please sign in to comment.