summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2005-06-28 16:13:51 +0000
committermihaylov <mihaylov@epfl.ch>2005-06-28 16:13:51 +0000
commit6dd54e71a11b445d437d7f379947f94b4a6544b1 (patch)
tree525d620da3cb4e7ade58818ed79d5d9b1f5b9696
parent74fa0daa1afb949ad88b25249c027238f271ad79 (diff)
downloadscala-6dd54e71a11b445d437d7f379947f94b4a6544b1.tar.gz
scala-6dd54e71a11b445d437d7f379947f94b4a6544b1.tar.bz2
scala-6dd54e71a11b445d437d7f379947f94b4a6544b1.zip
Introduced a top-level try-catch to hide the st...
Introduced a top-level try-catch to hide the stack trace if the compiler throws AbortError exception; the -debug option prints the stack trace
-rw-r--r--sources/scala/tools/scalac/Main.scala15
1 files changed, 12 insertions, 3 deletions
diff --git a/sources/scala/tools/scalac/Main.scala b/sources/scala/tools/scalac/Main.scala
index 838019e53f..1542f98a21 100644
--- a/sources/scala/tools/scalac/Main.scala
+++ b/sources/scala/tools/scalac/Main.scala
@@ -48,9 +48,18 @@ object Main {
val timer = scalac_Global.getTimer(reporter);
timer.start();
val global = new Global(command, timer, false);
- val units = global.compile(command.files.toArray(), false);
- if (reporter.errors() == 0)
- if (!global.PHASE.CODEGEN.hasSkipFlag()) global.dump(units);
+ try {
+ val units = global.compile(command.files.toArray(), false);
+ if (reporter.errors() == 0)
+ if (!global.PHASE.CODEGEN.hasSkipFlag()) global.dump(units);
+ } catch {
+ case e: scala.tools.util.debug.AbortError =>
+ if (global.debug)
+ e.printStackTrace();
+ else
+ global.error("Internal compiler error: " + e.getMessage()
+ + "; use -debug to see a stack trace");
+ }
timer.stop("total");
reporter.printSummary();
}