Skip to content

Commit

Permalink
Improve missing workflow err message [ci skip] (#2871)
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
  • Loading branch information
pditommaso and ewels committed May 14, 2022
1 parent 6e029b7 commit da101e8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions modules/nextflow/src/main/groovy/nextflow/script/BaseScript.groovy
Expand Up @@ -184,8 +184,22 @@ abstract class BaseScript extends Script implements ExecutionContext {
if( !entryFlow ) {
if( meta.getLocalWorkflowNames() )
log.warn "No entry workflow specified"
if( meta.getLocalProcessNames() )
throw new AbortOperationException("Missing workflow definition - DSL2 requires at least a workflow block in the main script")
if( meta.getLocalProcessNames() ) {
final msg = """\
=============================================================================
= WARNING =
= You are running this script using DSL2 syntax, however it does not =
= contain any 'workflow' definition so there's nothing for Nextflow to run. =
= =
= If this script was written using Nextflow DSL1 syntax, please add the =
= setting 'nextflow.enable.dsl=1' to the nextflow.config file or use the =
= command-line option '-dsl1' when running the pipeline. =
= =
= More details at this link: https://www.nextflow.io/docs/latest/dsl2.html =
=============================================================================
""".stripIndent()
throw new AbortOperationException(msg)
}
return result
}

Expand Down

0 comments on commit da101e8

Please sign in to comment.