MethodDescriptor.call: don't convert unchecked exceptions into EvalException. Also, move some code that doesn't need to be in the try block out of it. Closes #8266. PiperOrigin-RevId: 251673653
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java index 86730ac..4528501 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java +++ b/src/main/java/com/google/devtools/build/lib/packages/RuleClass.java
@@ -211,7 +211,15 @@ * messaging should be done via {@link RuleErrorConsumer}; this exception only interrupts * configured target creation in cases where it can no longer continue. */ - public static final class RuleErrorException extends Exception {} + public static final class RuleErrorException extends Exception { + public RuleErrorException() { + super(); + } + + public RuleErrorException(String message) { + super(message); + } + } } /**
diff --git a/src/main/java/com/google/devtools/build/lib/packages/RuleErrorConsumer.java b/src/main/java/com/google/devtools/build/lib/packages/RuleErrorConsumer.java index 8b63425..68dc985 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/RuleErrorConsumer.java +++ b/src/main/java/com/google/devtools/build/lib/packages/RuleErrorConsumer.java
@@ -55,7 +55,7 @@ */ default RuleErrorException throwWithRuleError(String message) throws RuleErrorException { ruleError(message); - throw new RuleErrorException(); + throw new RuleErrorException(message); } /** @@ -70,7 +70,7 @@ default RuleErrorException throwWithAttributeError(String attrName, String message) throws RuleErrorException { attributeError(attrName, message); - throw new RuleErrorException(); + throw new RuleErrorException(message); } /**