Is there a good way to throw an informative error ...
# nostupidquestions
s
Is there a good way to throw an informative error in the instance of a channel being empty in certain cases? Basically I've got a pipeline with two input modes, explicit (where users provide direct paths to input FASTQs in the samplesheet) and implicit (where users provide a path with a param then the workflow matches the entries in the samplesheet with files in said directory). In the case where a user wants to run the pipeline with input file matching but nothing is matched the pipeline just exits successfully due to having no work to do (empty channel where samplesheet is joined to directory contents), I want to throw a nice informative error in this instance but cannot think of a good way to do so...
The
filter
is important not to trigger a downstream execution
🎉 1
s
Amazing thanks mahesh
👍🏽 1
Can you expand on the purpose of the filter? Will this explicitly error out?
m
When the channel is empty, it'll run the
log.warn
, but Groovy expressions always return the value of the last expression evaluated, which is
null
from
log.warn
. So the
filter
is explicitly there to remove the return of
log.warn
and let anything else progress
👍 1