From 4a43db8474588a3d6fd7925f7d44483df4b64a90 Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Sun, 19 Jun 2022 15:44:31 +0200 Subject: [PATCH] Improve error message for missing plugin extension [ci fast] Signed-off-by: Paolo Di Tommaso --- .../extension/ChannelExtensionProvider.groovy | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/extension/ChannelExtensionProvider.groovy b/modules/nextflow/src/main/groovy/nextflow/extension/ChannelExtensionProvider.groovy index f9ac69844d..cd572e561b 100644 --- a/modules/nextflow/src/main/groovy/nextflow/extension/ChannelExtensionProvider.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/extension/ChannelExtensionProvider.groovy @@ -29,6 +29,7 @@ import groovyx.gpars.dataflow.DataflowReadChannel import groovyx.gpars.dataflow.DataflowWriteChannel import nextflow.Global import nextflow.Session +import nextflow.exception.AbortOperationException import nextflow.plugin.Plugins import nextflow.script.ChannelOut /** @@ -104,10 +105,12 @@ class ChannelExtensionProvider implements ExtensionProvider { * The class itself to allow method chaining */ ChannelExtensionProvider loadPluginExtensionMethods(String pluginId, Map includedNames){ - final ext= findPluginExtensionMethods(pluginId) - if( ext ) { - loadPluginExtensionMethods(ext, includedNames) - } + final extensions= Plugins.getExtensionsInPluginId(ChannelExtensionPoint, pluginId) + if( !extensions ) + throw new AbortOperationException("Plugin '$pluginId' does not implement any extension point") + if( extensions.size()>1 ) + throw new AbortOperationException("Plugin '$pluginId' implements more than one extension point: ${extensions.collect(it -> it.class.getSimpleName()).join(',')}") + loadPluginExtensionMethods(extensions.first(), includedNames) return instance = this } @@ -214,10 +217,6 @@ class ChannelExtensionProvider implements ExtensionProvider { } } - protected ChannelExtensionPoint findPluginExtensionMethods(String pluginId) { - Plugins.getExtensionsInPluginId(ChannelExtensionPoint, pluginId)?.first() - } - @Deprecated static void reloadExtensionPoints() { if( !instance )