fs2-rabbit icon indicating copy to clipboard operation
fs2-rabbit copied to clipboard

Consumer streams terminate on `F.raiseError` from `EnvelopeDecoder`s

Open Daenyth opened this issue 5 years ago • 3 comments

This makes it a big pain to use with a parsed type.

Some options were explored in #151, but not completed.

We will want to provide some means to handle those automatically for users, because for example, json decoding using circe is a common use case, and you cannot prevent a publisher from submitting invalid json, or incorrect structure for your given circe.Decoder

As a workaround so far, I've found this useful:

  /** Convert a decoder producing `A` to a decode that handles failure with `Left` */
  implicit def fallibleDecoder[F[_], A, E](
      implicit decoder: EnvelopeDecoder[F, A],
      F: MonadError[F, E]
  ): EnvelopeDecoder[F, Either[E, A]] =
    decoder.attempt

Daenyth avatar Feb 07 '20 20:02 Daenyth

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 30 '20 09:07 stale[bot]

@gvolpe ^ Is there a way we can configure that bot to exclude certain things?

Daenyth avatar Jul 30 '20 16:07 Daenyth

Added the pinned label, that should be enough

gvolpe avatar Jul 30 '20 18:07 gvolpe