Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runtime error for missing channel factory #5170

Merged
merged 2 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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()'
}

}