diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/Main.scala | 9 | ||||
-rw-r--r-- | src/library/scala/util/control/NoStackTrace.scala | 16 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index ff197a125c..de1d148a36 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -109,11 +109,12 @@ object Main extends AnyRef with EvalLoop { } } catch { - case FatalError(msg) => - reporter.error(null, "fatal error: " + msg) - case ex if compiler.opt.richExes => + case ex => compiler.logThrowable(ex) - throw ex + ex match { + case FatalError(msg) => reporter.error(null, "fatal error: " + msg) + case _ => throw ex + } } } } diff --git a/src/library/scala/util/control/NoStackTrace.scala b/src/library/scala/util/control/NoStackTrace.scala index a1cb8e0236..d8cd36aa02 100644 --- a/src/library/scala/util/control/NoStackTrace.scala +++ b/src/library/scala/util/control/NoStackTrace.scala @@ -9,12 +9,20 @@ package scala.util.control /** A trait for exceptions which, for efficiency reasons, do not - * fill in the stack trace. + * fill in the stack trace. Stack trace suppression can be disabled + * on a global basis by setting the system property named at + * NoStackTrace.DisableProperty. * * @author Paul Phillips * @since 2.8 */ -trait NoStackTrace extends Throwable -{ - override def fillInStackTrace(): Throwable = this +trait NoStackTrace extends Throwable { + override def fillInStackTrace(): Throwable = + if (sys.props contains NoStackTrace.DisableProperty) super.fillInStackTrace() + else this +} + +object NoStackTrace { + // TODO: systematic naming scheme. + final val DisableProperty = "scala.control.no-trace-suppression" } |