When implementing a simple flow stage I often encounter the problem how to
deal with errors (not failures). The most often made proposal I found is to
make it explicit and pass it as Try to out.
Most flows I currently can imagine do have some kind of error behavior. So
if I would provide flows in a reusable manner the type of most flows would
be some input type to Try of output type like so:
Flow[X, Try[Y], Unit]
In fact HttpExt.superPool solves this issue in a similar manner:
Flow[(HttpRequest, T), (Try[HttpResponse]), Unit]
When plumbing all those flows together I face some impedance mismatch. All
the inputs are simple types whereas the outputs are usually simple types
wrapped into a Try (or maybe Either) container.
How can I plug them together if I want the error to show up in the Sink
without stopping the stream?
I'm looking for a way where I can concentrate on the happy path while not
loosing the error case. I hope that I don't need to transform all my flows
into graphs with two outputs like std and error output.
When programming with functions this kind of issue is solved quite
elegantly by using a for comprehension:
def eval*[A, B](x: A): Try[B] = ???
val result: Try[_] = for { x <- evalX(a) y <- evalY(x) z <- evalZ(y)
} yield z.finalResult
Kind Regards,
Leslie Leder
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.