summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2011-04-05 16:19:45 +0000
committerIulian Dragos <jaguarul@gmail.com>2011-04-05 16:19:45 +0000
commitf0a2dd936e3ccc7d3dbd8d86b55e20ac29933839 (patch)
tree8ee8d738a2535a7913008ecd2f162aa071539aa3 /src
parent804c401ffd828e0700776b65026179649b27b8d9 (diff)
downloadscala-f0a2dd936e3ccc7d3dbd8d86b55e20ac29933839.tar.gz
scala-f0a2dd936e3ccc7d3dbd8d86b55e20ac29933839.tar.bz2
scala-f0a2dd936e3ccc7d3dbd8d86b55e20ac29933839.zip
Wrapped exceptions coming from calls to 'ask' i...
Wrapped exceptions coming from calls to 'ask' in a FailedException. This allows to get a stack trace from both the presentation compiler thread and the calling thread. review by odersky.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/CompilerControl.scala1
-rw-r--r--src/compiler/scala/tools/nsc/util/InterruptReq.scala8
2 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
index 51ee6bf5fb..bcc8f46b19 100644
--- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
+++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
@@ -316,4 +316,3 @@ object ShutdownReq extends ControlThrowable
class NoSuchUnitError(file: AbstractFile) extends Exception("no unit found for file "+file)
class MissingResponse extends Exception("response missing")
-
diff --git a/src/compiler/scala/tools/nsc/util/InterruptReq.scala b/src/compiler/scala/tools/nsc/util/InterruptReq.scala
index 342284fb70..fb7f313715 100644
--- a/src/compiler/scala/tools/nsc/util/InterruptReq.scala
+++ b/src/compiler/scala/tools/nsc/util/InterruptReq.scala
@@ -1,6 +1,8 @@
package scala.tools.nsc
package util
+import interactive.AskException
+
/** A class of work items to be used in interrupt requests.
*/
abstract class InterruptReq {
@@ -24,7 +26,7 @@ abstract class InterruptReq {
notify()
}
- /** To be called from interrupting client to get result fo interrupt */
+ /** To be called from interrupting client to get result for interrupt */
def getResult(): R = synchronized {
while (result.isEmpty) {
try {
@@ -34,7 +36,9 @@ abstract class InterruptReq {
result.get match {
case Left(res) => res
- case Right(t) => throw t
+ case Right(t) => throw new FailedInterrupt(t)
}
}
}
+
+class FailedInterrupt(cause: Throwable) extends Exception("Compiler exception during call to 'ask'", cause)