Skip to content

Commit

Permalink
[bugfix] Fix blocking implementation for CatsMonadAsyncError (#3309)
Browse files Browse the repository at this point in the history
  • Loading branch information
kciesielski authored Nov 9, 2023
1 parent 2c26873 commit 271bf2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ class CatsMonadError[F[_]](implicit F: Sync[F]) extends MonadError[F] {
override def suspend[T](t: => F[T]): F[T] = F.defer(t)
override def flatten[T](ffa: F[F[T]]): F[T] = F.flatten(ffa)
override def ensure[T](f: F[T], e: => F[Unit]): F[T] = F.guaranteeCase(f)(_ => e)
override def blocking[T](t: => T): F[T] = F.blocking(t)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ import sttp.tapir.integ.cats.effect.CatsMonadError
private class CatsMonadAsyncError[F[_]](implicit F: Async[F]) extends CatsMonadError[F] with MonadAsyncError[F] {
override def async[T](register: ((Either[Throwable, T]) => Unit) => Canceler): F[T] =
F.async(cb => F.delay(register(cb)).map(c => Some(F.delay(c.cancel()))))

override def blocking[T](t: => T): F[T] =
F.blocking(t)
}

0 comments on commit 271bf2c

Please sign in to comment.