aboutsummaryrefslogtreecommitdiff
path: root/libraries/eval/Eval.scala
diff options
context:
space:
mode:
authorRobey Pointer <robey@twitter.com>2011-02-28 12:07:53 -0800
committerChristopher Vogt <oss.nsp@cvogt.org>2016-11-07 02:08:37 -0500
commit1a0362e888ed04d3dc97611aca4745aeac682716 (patch)
treebfd76143e9bdda1f520fe55db16c0bea33d008f6 /libraries/eval/Eval.scala
parent705f9e24481693297e98db79adbb9aa8cd1c5a96 (diff)
downloadcbt-1a0362e888ed04d3dc97611aca4745aeac682716.tar.gz
cbt-1a0362e888ed04d3dc97611aca4745aeac682716.tar.bz2
cbt-1a0362e888ed04d3dc97611aca4745aeac682716.zip
throw a reasonable error if we can't find scala-compiler or scala-library. this can be really hard to puzzle out from the base exception.
Diffstat (limited to 'libraries/eval/Eval.scala')
-rw-r--r--libraries/eval/Eval.scala15
1 files changed, 13 insertions, 2 deletions
diff --git a/libraries/eval/Eval.scala b/libraries/eval/Eval.scala
index 4bd7ac2..41e1241 100644
--- a/libraries/eval/Eval.scala
+++ b/libraries/eval/Eval.scala
@@ -34,8 +34,19 @@ import scala.tools.nsc.util.{BatchSourceFile, Position}
* Evaluate a file or string and return the result.
*/
object Eval {
- private val compilerPath = jarPathOfClass("scala.tools.nsc.Interpreter")
- private val libPath = jarPathOfClass("scala.ScalaObject")
+ private val compilerPath = try {
+ jarPathOfClass("scala.tools.nsc.Interpreter")
+ } catch {
+ case e =>
+ throw new RuntimeException("Unable lo load scala interpreter from classpath (scala-compiler jar is missing?)", e)
+ }
+
+ private val libPath = try {
+ jarPathOfClass("scala.ScalaObject")
+ } catch {
+ case e =>
+ throw new RuntimeException("Unable to load scala base object from classpath (scala-library jar is missing?)", e)
+ }
private val jvmId = java.lang.Math.abs(new Random().nextInt())