-
Notifications
You must be signed in to change notification settings - Fork 642
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
Provide a special class for pipeline-defined error messages #4937
Comments
Optimum would be if Nextflow can determine where the Then no change to pipeline source code would be required. |
These are two slightly different beasts. For the logger, it could be as simple as modifying the layout of messages. Although, we would then need two different loggers, one (or more) for core nextflow and another exposed to the pipeline that can be customized without affecting the others. I don't know for sure, but I'm guessing that errors do not use logging facilities and thus need to be customized separately. Or indeed define a simple function/class method that performs some message layouting and then exits with an error code. |
Yes, sorry to be clear: I'm aware that the logging and error message are generated in two separate ways. I meant more that in this case, given I'm requesting that pipeline developers can define their own errors or warnings, these should follow a common structure for familiarity for the pipeline user. |
Adding my comment here: One of my issues was that something ends up in the channel too if |
New feature
It would be nice to have a special error class or function for pipeline-level errors or warnings, that help distinguish pipeline-defined (conditional) errors versus Nextflow level errors
Usage scenario
Pipelines will often have their own checks or validations, for example mutually exclusive parameters, that they will want to report to a user. Currently it is expected that a pipeline uses
error("error message")
to report this.Often these are 'simple' errors, compared to Nextflow errors that have a more technical reason for the problem.
It might nice to be able to distinguish such pipeline-level errors from Nextflow errors. One benefit would be that it makes it much faster to identify where the error is coming from for developers, so they can quickly guide a user to a solution (i.e., whether it's a simple fix, or something the developer needs to investigate deeper.
Currently I do this manually by adding a prefix to warnings or logs, but it could be nice to have this happen automatically. Furthermore the way to report an error vs warning is slightly different (to my understanding anyway).
e.g. to report an error I do the following with the pipeline name as a prefix:
https://github.com/nf-core/taxprofiler/blob/45ce748534872c5105a5d3a94b83f47cd44f8826/workflows/taxprofiler.nf#L36
vs a warning
https://github.com/nf-core/taxprofiler/blob/45ce748534872c5105a5d3a94b83f47cd44f8826/workflows/taxprofiler.nf#L48
Where I have to manually specify
ERROR:
in when usingerror()
, but thelog.warn()
autmatically putsWARN
at the beginning. I guess there is alog.error
but my understanding this doesn't cause the pipeline run to exit 'nicely'.Suggest implementation
Could be nice to have something a native
pipelineError("")
- thing the prefixes the workflow name at the beginning etc.It could also have a distinct colour from a Nextflow level error.
More info
I initially brought this up for discussion with nf-core (in particular @ewels and @maxulysse) here: https://nfcore.slack.com/archives/C04QR0T3G3H/p1713533132261319 based on the suggestion from @Midnighter here: nf-core/taxprofiler#60 (comment).
All three may be able to provide better (technical) suggestions and/or benefits.
The text was updated successfully, but these errors were encountered: