Propagate exceptions when caching in order to make errors less magic

This commit is contained in:
Šesták Vít
2016-12-19 13:29:15 +01:00
parent 0ef9636148
commit 97fef173af

View File

@@ -25,8 +25,9 @@ class ProjectReportsProvider @Inject() (
(implicit executionContext: ExecutionContext): Future[T] =
{
cache.get[T](name).map(Future.successful).getOrElse(
f.andThen{
case Success(value) =>cache.set(name, value, expiration)
f.map{ value =>
cache.set(name, value, expiration)
value
}
)
}