Log metadata fetching from js

Lost in refactoring
This commit is contained in:
Alexandre Archambault 2015-06-26 13:42:19 +02:00
parent e5df5f6a1b
commit 4e0094f12d
1 changed files with 10 additions and 4 deletions

View File

@ -84,11 +84,17 @@ case class Fetch(root: String,
def apply(artifact: Artifact, def apply(artifact: Artifact,
cachePolicy: Repository.CachePolicy): EitherT[Task, String, String] = { cachePolicy: Repository.CachePolicy): EitherT[Task, String, String] = {
val url0 = root + artifact.url
EitherT( EitherT(
Task { implicit ec => Task { implicit ec =>
Fetch.get(root + artifact.url) Future(logger.foreach(_.fetching(url0)))
.map(\/-(_)) .flatMap(_ => Fetch.get(url0))
.recover{case e: Exception => -\/(e.getMessage)} .map{ s => logger.foreach(_.fetched(url0)); \/-(s) }
.recover{case e: Exception =>
logger.foreach(_.other(url0, e.getMessage))
-\/(e.getMessage)
}
} }
) )
} }