diff options
author | Paul Phillips <paulp@improving.org> | 2011-02-09 09:31:41 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-02-09 09:31:41 +0000 |
commit | 27a658c86e06b865cba1b3d1d2b0bc423fe0ad9a (patch) | |
tree | 642b57c38c3db9a7544a3e3dfa9511f065ac979e /src | |
parent | 6d19219483b7cc42fa34af49654108fa5cb975fe (diff) | |
download | scala-27a658c86e06b865cba1b3d1d2b0bc423fe0ad9a.tar.gz scala-27a658c86e06b865cba1b3d1d2b0bc423fe0ad9a.tar.bz2 scala-27a658c86e06b865cba1b3d1d2b0bc423fe0ad9a.zip |
Added a system property which disables stack tr...
Added a system property which disables stack trace suppression. (At
present it is the very terse -Dscala.control.no-trace-suppression.)
This makes zero-output crashes involving things like MissingType
significantly less maddening. It would behoove us to have a central
naming scheme for such properties. Review by community.
Diffstat (limited to 'src')
-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" } |