ritesh singh
03/05/2025, 9:05 AM.throwing
call.
Is it possible to catch the exception thrown by gradle-core plugin or any third-party library or plugin and modify it a bit to throw ours based on the failure or exception type?ritesh singh
03/05/2025, 9:06 AMVampire
03/05/2025, 10:14 AMritesh singh
03/05/2025, 10:15 AMVampire
03/05/2025, 10:16 AMactions
in a local variable, clear the actions, add a doFirst
action that has a try/catch
and inside calls the persisted actions
, this way you can catch the thrown exceptions and handle them as you please, unless after that some other actions are added of course.Jendrik Johannes
03/05/2025, 11:48 AMabstract public class MyFlowAction implements FlowAction<RecommendationsAction.Parameter> {
public interface Parameter extends FlowParameters {
@Input
Property<Throwable> getError();
}
@Override
public void execute(Parameter parameters) {
if (parameters.getError().isPresent()) {
String message = null;
Throwable t = parameters.getError().get();
if (somCondition) {
throw new RuntimeException(myOwnMessage);
}
}
}
}
// Register FlowAction
flowScope.always(MyFlowAction.class,
spec -> spec.getParameters().getError().set(flowProviders.getBuildWorkResult().map(r -> r.getFailure().orElse(null))
));
ritesh singh
03/05/2025, 12:11 PMVampire
03/05/2025, 12:17 PMritesh singh
03/05/2025, 12:17 PM