summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/ant/Scaladoc.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-07-20 16:21:00 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-20 17:19:50 +0200
commite4db7e05023d66a42bddcd0d194cf239971de9d4 (patch)
tree689bb8d78e84f3da6a1c6f1ddbe0ef634b555df8 /src/compiler/scala/tools/ant/Scaladoc.scala
parentc1816313f52860d47dc7f3efed195f5b0482743b (diff)
downloadscala-e4db7e05023d66a42bddcd0d194cf239971de9d4.tar.gz
scala-e4db7e05023d66a42bddcd0d194cf239971de9d4.tar.bz2
scala-e4db7e05023d66a42bddcd0d194cf239971de9d4.zip
address "this would catch all throwables" warnings
original patch by @odersky in #955 -- criterion for the refactor: "catch Throwable as long as there's no obvious control flow exception going through the catch and the caught exception is processed further" rebased & updated with review comments in #955 and #954
Diffstat (limited to 'src/compiler/scala/tools/ant/Scaladoc.scala')
-rw-r--r--src/compiler/scala/tools/ant/Scaladoc.scala10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala
index 6201501a71..b96ac6f29b 100644
--- a/src/compiler/scala/tools/ant/Scaladoc.scala
+++ b/src/compiler/scala/tools/ant/Scaladoc.scala
@@ -675,14 +675,10 @@ class Scaladoc extends ScalaMatchingTask {
"; see the documenter output for details.")
reporter.printSummary()
} catch {
- case exception: Throwable if exception.getMessage ne null =>
+ case exception: Throwable =>
exception.printStackTrace()
- safeBuildError("Document failed because of an internal documenter error (" +
- exception.getMessage + "); see the error output for details.")
- case exception : Throwable =>
- exception.printStackTrace()
- safeBuildError("Document failed because of an internal documenter error " +
- "(no error message provided); see the error output for details.")
+ val msg = Option(exception.getMessage) getOrElse "no error message provided"
+ safeBuildError(s"Document failed because of an internal documenter error ($msg); see the error output for details.")
}
}
}