diff options
author | Paul Phillips <paulp@improving.org> | 2009-04-28 21:53:29 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-04-28 21:53:29 +0000 |
commit | 6029fa793184426e4cc9e81fddcd5acee902311d (patch) | |
tree | d4824dc4920e34427ca5d853dcf2eaf43d4b05ff /src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | |
parent | 6875e2fde566b0ced981fb092480827778483f1e (diff) | |
download | scala-6029fa793184426e4cc9e81fddcd5acee902311d.tar.gz scala-6029fa793184426e4cc9e81fddcd5acee902311d.tar.bz2 scala-6029fa793184426e4cc9e81fddcd5acee902311d.zip |
Added a MissingRequirementError variant of Fata...
Added a MissingRequirementError variant of FatalError so as to
improve the amazingly confusing "class file is broken" message which
people get whenever they are missing a dependency. Before: class file
'jdo2-api-2.3-SNAPSHOT.jar(javax/jdo/Transaction.class)' is broken
After: Missing dependency 'class javax.transaction.Synchronization',
required by jdo2-api-2.3-SNAPSHOT.jar(javax/jdo/Transaction.class)
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 426a9d4a52..a4dcdc8fee 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -51,6 +51,9 @@ abstract class ClassfileParser { } def parse(file: AbstractFile, root: Symbol) = try { + def handleMissing(e: MissingRequirementError) = + throw new IOException("Missing dependency '" + e.req + "', required by " + in.file) + def handleError(e: Exception) = { if (settings.debug.value) e.printStackTrace() throw new IOException("class file '" + in.file + "' is broken\n(" + { @@ -84,8 +87,8 @@ abstract class ClassfileParser { this.pool = new ConstantPool parseClass() } catch { - case e: FatalError => handleError(e) - case e: RuntimeException => handleError(e) + case e: MissingRequirementError => handleMissing(e) + case e: RuntimeException => handleError(e) } } finally { busy = false |