nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Error messages inside ifEmpty() are shown even when the channel is not empty

Open mirpedrol opened this issue 2 years ago • 0 comments

Bug report

Expected behavior and actual behavior

When using the closure ifEmpty() with an error message in it, the error message is shown together with other errors. These errors shouldn't be printed if the channel is not empty.

Steps to reproduce the problem

my_channel = Channel.of(1,2,3)
my_channel.ifEmpty{
    error("error inside ifEmpty")
}

When running the following code, no error is produced as expected.

my_channel = Channel.of(1,2,3)
my_channel.ifEmpty{
    error("error inside ifEmpty")
}
error("my error")

But if there is another error in the script, we see both errors printed in the screen, even though only "my error" killed the run.

Program output

N E X T F L O W  ~  version 23.11.0-edge
Launching `main.nf` [soggy_planck] DSL2 - revision: 5d52f38270
my error
error inside ifEmpty

Environment

  • Nextflow version: 23.11.0-edge
  • Java version: [?]
  • Operating system: [macOS, Linux, etc]
  • Bash version: (use the command $SHELL --version)

Additional context

mirpedrol avatar Dec 06 '23 09:12 mirpedrol