scala - For-Comprehension Future with exceptions -



scala - For-Comprehension Future with exceptions -

i have 2 future , want recover exceptions on 1 of them :

def getid(): future[either[exception, id]] = ... def result(): future[result] = ...

i have seek this:

for { id <- getid() r <- result(id, param, param) } yield { r } recover { case e => println(e.getmessage) }

someone can help me?

many before.

you should recover @ val beingness processed rather @ for. below code sets id , r 0 if exception thrown.

for { id = getid() id.recover { case e => { println(e.getmessage) 0 } } r = result(id, param, param) } yield r.recover { case e => { println(e.getmessage) 0 } }

scala

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -