* @throws Exception any exception thrown by the given closure
*/
public static Handler chain(@Nullable LaunchConfig launchConfig, @Nullable Registry registry, @DelegatesTo(value = GroovyChain.class, strategy = Closure.DELEGATE_FIRST) Closure<?> closure) throws Exception {
return ChainBuilders.build(
launchConfig != null && launchConfig.isDevelopment(),
new GroovyDslChainActionTransformer(launchConfig, registry),
new ClosureInvoker<Object, GroovyChain>(closure).toAction(registry, Closure.DELEGATE_FIRST)
);
}