mirror of https://github.com/sbt/sbt.git
Better error printing
This commit is contained in:
parent
72d29f5223
commit
f45c2b0aaa
|
|
@ -53,7 +53,7 @@ case class Coursier(
|
|||
println(s"Downloading $url")
|
||||
def downloaded(url: String, success: Boolean) =
|
||||
if (!success)
|
||||
println(s"Failed to download $url")
|
||||
println(s"Failed: $url")
|
||||
def readingFromCache(f: File) = {}
|
||||
def puttingInCache(f: File) = {}
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ case class Coursier(
|
|||
println(s"Downloading $url")
|
||||
def downloadedArtifact(url: String, success: Boolean) =
|
||||
if (!success)
|
||||
println(s"Failed to download $url")
|
||||
println(s"Failed: $url")
|
||||
}
|
||||
|
||||
def verboseLogger: MavenRepository.Logger with Files.Logger =
|
||||
|
|
@ -72,7 +72,7 @@ case class Coursier(
|
|||
def downloaded(url: String, success: Boolean) =
|
||||
println(
|
||||
if (success) s"Downloaded $url"
|
||||
else s"Failed to download $url"
|
||||
else s"Failed: $url"
|
||||
)
|
||||
def readingFromCache(f: File) = {
|
||||
println(s"Reading ${fileRepr(f)} from cache")
|
||||
|
|
@ -87,7 +87,7 @@ case class Coursier(
|
|||
def downloadedArtifact(url: String, success: Boolean) =
|
||||
println(
|
||||
if (success) s"Downloaded $url"
|
||||
else s"Failed to download $url"
|
||||
else s"Failed: $url"
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -220,9 +220,9 @@ case class Coursier(
|
|||
|
||||
val errors = res.errors
|
||||
if (errors.nonEmpty) {
|
||||
println(s"${errors.size} error(s):")
|
||||
println(s"\n${errors.size} error(s):")
|
||||
for ((dep, errs) <- errors) {
|
||||
println(s" ${dep.module}:\n ${errs.map(" " + _.replace("\n", " \n")).mkString("\n")}")
|
||||
println(s" ${dep.module}:${dep.version}:\n${errs.map(" " + _.replace("\n", " \n")).mkString("\n")}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,11 @@ case class MavenRepository(
|
|||
conn.setRequestProperty("User-Agent", "")
|
||||
MavenRepository.readFully(conn.getInputStream())
|
||||
}
|
||||
def logEnd(success: Boolean) = logger.foreach(_.downloaded(urlStr, success))
|
||||
|
||||
log.flatMap(_ => get)
|
||||
log
|
||||
.flatMap(_ => get)
|
||||
.map{ res => logEnd(res.isRight); res }
|
||||
}
|
||||
|
||||
def save(s: String) = {
|
||||
|
|
@ -115,7 +118,12 @@ object MavenRepository {
|
|||
finally is0.close()
|
||||
|
||||
new String(b, "UTF-8")
|
||||
} .leftMap(_.getMessage)
|
||||
} .leftMap{
|
||||
case e: java.io.FileNotFoundException =>
|
||||
s"Not found: ${e.getMessage}"
|
||||
case e =>
|
||||
s"$e: ${e.getMessage}"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue