handling errors

handleError

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .handleError(_ => 'd')
  .compile
  .toList

diagram

handleError (with chunks)

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .handleError(_ => 'd')
  .compile
  .toList

diagram

handleError2

Stream('a', 'b', 'c')
  .evalMap(x => IO.raiseWhen(x == 'b')(Err).as(x).handleError(_ => 'd'))
  .handleError(_ => 'd')
  .compile
  .toList

diagram

handleError2 (with chunks)

Stream('a', 'b', 'c')
  .evalMap(x => IO.raiseWhen(x == 'b')(Err).as(x).handleError(_ => 'd'))
  .handleError(_ => 'd')
  .compile
  .toList

diagram

handleErrorWith

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .handleErrorWith(_ => Stream('d', 'e', 'f'))
  .compile
  .toList

diagram

handleErrorWith (with chunks)

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .handleErrorWith(_ => Stream('d', 'e', 'f'))
  .compile
  .toList

diagram

attempt

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .attempt
  .compile
  .toList

diagram

attempt (with chunks)

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .attempt
  .compile
  .toList

diagram

attempts

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .attempts(Stream.empty)
  .take(4)
  .compile
  .toList

diagram

attempts (with chunks)

Stream('a', 'b', 'c')
  .evalTap(x => IO.raiseWhen(x == 'b')(Err))
  .attempts(Stream.empty)
  .take(4)
  .compile
  .toList

diagram