Let me expand: there is nothing in the type system that will make you handle exceptions in Futures, in the way that Option or Either make you handle the failure case. It is easy for a Future to fail and you to never see a stack trace. E.g. this will silently fail:
Future { 1 / 0 }
An alternative is to encode the possibility of failure in the type system by using Future[Validation[E,A]] (replace Validation with Try or Either as the whim takes you). Then the type system will remind you to handle the failure case. See my link above for more (scroll down a bit to see the section on error handling).
noelwelsh|13 years ago
mmaltiar|13 years ago
for example we have future onSuccess future onFailure
or we have onComplete, future onComplete { case Success(result) ⇒ doSomethingOnSuccess(result) case Failure(failure) ⇒ doSomethingOnFailure(failure) }
else you can follow what is mentioned by noelwalsh