diff --git a/modules/nextflow/src/main/groovy/nextflow/plugin/extension/PluginExtensionProvider.groovy b/modules/nextflow/src/main/groovy/nextflow/plugin/extension/PluginExtensionProvider.groovy index 0ca983a6c1..31ad82587e 100644 --- a/modules/nextflow/src/main/groovy/nextflow/plugin/extension/PluginExtensionProvider.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/plugin/extension/PluginExtensionProvider.groovy @@ -286,6 +286,9 @@ class PluginExtensionProvider implements ExtensionProvider { def factory = (ChannelFactoryInstance)reference.target return factory.invokeExtensionMethod(reference.method, args) } + else { + throw new MissingMethodException("Channel.${name}", Object.class, args) + } } } diff --git a/modules/nextflow/src/test/groovy/nextflow/script/ScriptDslTest.groovy b/modules/nextflow/src/test/groovy/nextflow/script/ScriptDslTest.groovy index 9e48c8e55e..3758ad497a 100644 --- a/modules/nextflow/src/test/groovy/nextflow/script/ScriptDslTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/script/ScriptDslTest.groovy @@ -604,4 +604,26 @@ class ScriptDslTest extends Dsl2Spec { result.val == 'Hello' } + + def 'should throw an exception on missing method' () { + + when: + dsl_eval ''' + Channel.doesNotExist() + ''' + then: + def e1 = thrown(MissingMethodException) + e1.message == 'No signature of method: java.lang.Object.Channel.doesNotExist() is applicable for argument types: () values: []' + + when: + dsl_eval ''' + workflow { + Channel.doesNotExist() + } + ''' + then: + def e2 = thrown(MissingProcessException) + e2.message == 'Missing process or function Channel.doesNotExist()' + } + }