Skylark: make ConversionException an EvalException
This avoids using a RuntimeException (IllegalArgumentException)
to circumvent declaration issues, which when we were catching it too well
was hiding actual issues of RuntimeException.
--
MOS_MIGRATED_REVID=95767534
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java b/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
index af33276..3c041b7 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
@@ -15,7 +15,6 @@
import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.events.Location;
-import com.google.devtools.build.lib.packages.Type.ConversionException;
import com.google.devtools.build.lib.syntax.SkylarkSignatureProcessor.HackHackEitherList;
import com.google.devtools.build.lib.syntax.SkylarkType.SkylarkFunctionType;
@@ -152,16 +151,14 @@
} catch (InvocationTargetException x) {
Throwable e = x.getCause();
if (e instanceof EvalException) {
- throw (EvalException) e;
+ throw ((EvalException) e).ensureLocation(loc);
} else if (e instanceof InterruptedException) {
throw (InterruptedException) e;
- } else if (e instanceof ConversionException
- || e instanceof ClassCastException
+ } else if (e instanceof ClassCastException
|| e instanceof ExecutionException
|| e instanceof IllegalStateException) {
- throw new EvalException(loc, e);
+ throw new EvalException(loc, "in call to " + getName(), e);
} else if (e instanceof IllegalArgumentException) {
- // Assume it was thrown by SkylarkType.cast and has a good message.
throw new EvalException(loc, "Illegal argument in call to " + getName(), e);
} else {
throw badCallException(loc, e, args);