From 27a658c86e06b865cba1b3d1d2b0bc423fe0ad9a Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 9 Feb 2011 09:31:41 +0000 Subject: 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. --- src/library/scala/util/control/NoStackTrace.scala | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/library') 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" } -- cgit v1.2.3