diff options
author | Adriaan Moors <adriaanm@gmail.com> | 2012-10-22 11:49:33 -0700 |
---|---|---|
committer | Adriaan Moors <adriaanm@gmail.com> | 2012-10-22 11:49:33 -0700 |
commit | 2978812698a2ab34379830b18c93f7116681a706 (patch) | |
tree | 56bd7d7c6d33de724180f8de436224afe3a2db3f /src | |
parent | 53a5d8f99132205067cb8396f13cd9e2e3b0fbd3 (diff) | |
parent | 1abc9013b825942ef0373a4e383efb627b379617 (diff) | |
download | scala-2978812698a2ab34379830b18c93f7116681a706.tar.gz scala-2978812698a2ab34379830b18c93f7116681a706.tar.bz2 scala-2978812698a2ab34379830b18c93f7116681a706.zip |
Merge pull request #1469 from rssh/printwriter-in-uncaught-exception
print stacktrace properly when -verbose
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index e8984adf7e..40a14aec6f 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -12,7 +12,7 @@ import scala.tools.util.PathResolver import scala.collection.{ mutable, immutable } import io.{ SourceReader, AbstractFile, Path } import reporters.{ Reporter, ConsoleReporter } -import util.{ Exceptional, ClassPath, MergedClassPath, StatisticsInfo, ScalaClassLoader, returning } +import util.{ Exceptional, ClassPath, MergedClassPath, StatisticsInfo, ScalaClassLoader, returning, stackTraceString } import scala.reflect.internal.util.{ NoPosition, OffsetPosition, SourceFile, NoSourceFile, BatchSourceFile, ScriptSourceFile } import scala.reflect.internal.pickling.{ PickleBuffer, PickleFormat } import symtab.{ Flags, SymbolTable, SymbolLoaders, SymbolTrackers } @@ -1525,11 +1525,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter) def compileUnits(units: List[CompilationUnit], fromPhase: Phase) { try compileUnitsInternal(units, fromPhase) catch { case ex: Throwable => - val shown = if (settings.verbose.value) { - val pw = new java.io.PrintWriter(new java.io.StringWriter) - ex.printStackTrace(pw) - pw.toString - } else ex.getClass.getName + val shown = if (settings.verbose.value) + stackTraceString(ex) + else + ex.getClass.getName // ex.printStackTrace(Console.out) // DEBUG for fsc, note that error stacktraces do not print in fsc globalError(supplementErrorMessage("uncaught exception during compilation: " + shown)) throw ex |